Mediterranean Gardening France

What's New? / Quoi de neuf ?

Join / Adhérer
Contact Us / Nous contacter

Reusable Blocks

Reusable blocks in WP are a feature which can be quite useful if correctly used. They are a sort of pre-defined block which can be either created on the fly or edited in a special reusable block editor. A reusable block may define as little as a type (paragraph), or as much as a container with layout information, format and content.

For example, one might define a two-column container with alignment information for the member columns and sub-block data including type (paragraph) and text. Another example would be a tab container defining colour of the background and number of initial tabs.

Once defined, a reusable block may be popped in to any page like a normal block thus potentially saving an enormous of time in formatting. It can also ensure standardization across the site – as long as a reusable block (RB) is used, it will be consistent throughout the site.

Here is where the use of a RB becomes very tricky. If you put in a RB and then edit it, for example use an RB for a preformatted column container with paragraphs in the columns, and then edit the text in the paragraph, you have altered the definition of the RB. Usually this is not what is intended, because that will be reflected wherever that RB is used in the site. What should be done is use the “convert to regular block” option available when the RB is selected. This makes the newly placed block an instance of the RB as opposed to the RB itself.

This is not, however, always the desired approach. There are two ways to use a RB: the most common one will be as a template to be define the overall container, structure or formatting in which case the method described above, changing the RB to an instance of the RB is the necessary approach. The other use might be to provide a fully defined and repeatable block which appears frequently throughout the site but not so consistently that it can be part of a page template. In this case the RB can be placed without conversion to a “regular block” instance of the RB. The advantage to this approach is that changing the RB will be automatically reflected throughout the site wherever that RB is used.

Currently defined Reusable Blocks are defined at the end of this page.

To create a RB, simply add the entire block structure to a page and then, at the top level of the container defining the block, select ‘add to reusable blocks’ from the pull-down. This adds it but doesn’t let you name it, so then select “manage reusable blocks” and edit the one called “untitled reusable block” to give it a name, change any of the content or structure, and the update it.

To my knowledge the only way to get to the RB Edit page is by clicking “manage reusable blocks” from the selections available to a RB but there may be a better way. Once at the page allowing management of RB’s you can modify or delete any of the RB’s.

Defined RB’s

RB-ClickToEnlarge provides the text paragraph used frequently throughout the site

Click on the images to enlarge them / Cliquez sur les images pour les agrandir

RB-BilingualText provides a two column container with two paragraphs in each column; the first paragraph contains the entries “English text” or “French Text” which should be replaced with the new text (after converting a a regular block); the second paragraph should be left blank to ensure side-by-side spacing of the bilingual text

English Text

French Text

RB-StandardTab provides a tab container with appropriate background colour. Again convert to a regular block before doing any editing