We are back with another edition of the WP-Content.co plugin of the month series and this time we are introducing yet another amazing plugin called Reusable Blocks Extended. It extends the Gutenberg Reusable Blocks feature with a complete admin panel, widgets, shortcodes and PHP functions. If you have previously been depending on reusable blocks but prefer the flexibility of block patterns, you may want to convert these. WordPress core developer Jean-Baptiste Audras has made this possible with the Reusable Blocks Extended plugin.
Why should you use Reusable blocks?
The idea of reusable blocks is to add the possibility to save a block – or a set of blocks – to reuse it outside of the context where it was created. Once saved, we can find it either in the block inserter tool in the “Reusables” section, or by searching it with the name you gave it. These blocks can be edited but they have a certain distinction in that they are intended to look the same in all places they are used. Any changes made to a reusable block will apply to all instances of the block wherever it is used.
If a user wants to make changes to a reusable block specific to one page, the process would involve clicking on the block’s properties and selecting “convert to regular block,” which would ensure that all edits would appear only on that specific instance of the block.
Features of Reusable Blocks Extended
1. Advanced Admin Panel
- Title of the reusable block, with native features like editing, trash and export tool
- For each reusable block, you can get the list of all Posts that are using it. Very useful to clean up unused Reusable blocks and to see how many Posts will be modified when you are doing some changes on a reusable block.
- Provides a custom shortcode to use your reusable block everywhere, even on Posts that don’t use the block editor!
- A custom PHP function to implement your reusable block in your theme files/templates.
- A HTML preview to see what your block looks like. This is an experimental feature and it doesn’t work with all themes (for example it works well on Twenty Twenty or Twenty Nineteen, but not on Twenty Sixteen).
- The date the block was last modified.
- For each reusable block, you can get a custom shortcode on Reusable blocks Admin screen
3. Custom PHP Functions
The plugin provides two functions to use your reusable blocks anywhere you need to, like in your theme or plugins:
reblex_display_block( $id ) where $id is the ID of your Reusable Block. This function will display/echo your reusable block.
reblex_get_block( $id ) where $id is the ID of your Reusable Block. This function will return the content of your reusable block.
Example: $my_block = reblex_get_block( 59 ) will put the content of Reusable block with ID 59 into $my_block PHP variable.
- Add Reusable Blocks dashboard informations
- Convert reusable blocks to block patterns in one click.
- Activate Reusable Blocks admin screen.
- Provide a list of Posts where each Reusable Block is used and the date it was last modified
- Provide a live preview of your reusable blocks from the Reusable Blocks admin screen, with your theme stylesheets
- Provide a Reusable Blocks Widget to use your block anywhere you want in your theme’s widgets areas
- Provide a Reusable Blocks Shortcode to use your block anywhere you want in your Post types (even if they use the Classic Editor rather than Gutenberg!)
- Provide some Reusable Blocks PHP functions to use your block anywhere you want in your theme.
Reusable blocks are one of the favourite features of the Gutenberg block editor. This feature provides the ability to reuse content across your whole website. So if you want to extend that feature you can definitely go for Reusable Blocks Extended.