Loomisoft's Reusable Content & Text Blocks plugin allows you to define modular and repeated blocks of text and other content and place them within pages, posts, sidebars, widgetised areas or anywhere on your site via shortcodes, via the provided widget or via PHP.
The idea behind this plugin is two-fold. The first is to modularise content so you can use the same content in multiple pages, posts and other places. The second is to provide an easy way to add complex custom content within sidebars and widgets.
The recent version 1.0.5 of the plugin was updated to support WPBakery's Visual Composer, Avada's Fusion Builder, Beaver Builder and SiteOrigin Page Builder.
Version 1.1.0 was updated to give greater control over how content blocks are pre-processed before being added to the containing page or post by providing a number of options as regards the "para" parameter (see below). While full content filtering is necessary to allow comatibility with visual page builders, other plugins (e.g. author information blocks, social sharing buttons, etc.) that are designed to insert content into posts and pages during this content filtering process will also kick into effect. The result is that these insertions end up being repeated more than once on a page or post with content blocks in them.
Version 1.2.0 was updated to provide a shortcode generator dialogue box for the WordPress TinyMCE WYSIWYG editor so that shortcodes can be added to posts and pages easily and quickly.
Content or text blocks can be added and managed via the custom "Content Blocks" post type in the same way that the normal WordPress posts and pages are. Once defined and published, they can be used in your posts, pages and other areas in your site.
Note: Only content blocks that are "published" will be displayed when used within the site. Others (i.e. those marked as "pending review", "draft", "private", "password protected" or set for future publication) will not be displayed.
Content blocks can be added to your pages, posts or anywhere in your site that accepts shortcodes by using the content block's post ID or slug using the following format:
[ls_content_block id="<ID>"]
[ls_content_block slug="<SLUG>"]
You can also use the "para" parameter, which gives you greater control over how the content is filtered. For example:
[ls_content_block id="<ID>" para="<PARA>"]
See section below for full options as regards this parameter.
Shortcodes can be easily and quickly be added to posts and pages by using the shortcode generator dialogue box from the WordPress TinyMCE WYSIWYG editor. This can be accessed by clicking the Loomisoft icon on the editor. The dialogue box allows the relevant content block, along with the various parameters, to be selected and inserted into the post.
A custom widget, the "Loomisoft Content Block" widget, is provided so you can easily add content blocks to your sidebars and other widgetised areas. This can be accessed through the normal WordPress admin area Appearance > Widgets.
Content blocks can also be added to your customised theme pages via PHP using the following code:
<?php echo ls_content_block_by_id( <ID> ); ?>
<?php echo ls_content_block_by_slug( '<SLUG>' ); ?>
Again, you can also use the second ("para") parameter, which (in the same way as the shortcodes above) gives you greater control over how the content is filtered. For example:
<?php echo ls_content_block_by_id( <ID>, '<PARA>' ); ?>
See section below for full options as regards this parameter.
This plugin supports:
It can also possibly be used with other visual page builders. However, others have not been tested.
To use content blocks with visual page builders, you will need to:
The "para" parameter can be used within the content block shortcodes or PHP calls to control how content blocks are pre-processed before being added to the containing page or post.
The syntax for the shortcode is as follows:
[ls_content_block id="<ID>" para="<PARA>"]
[ls_content_block slug="<SLUG>" para="<PARA>"]
And for PHP, the syntax is:
<?php echo ls_content_block_by_id( <ID>, '<PARA>' ); ?>
<?php echo ls_content_block_by_slug( '<SLUG>', '<PARA>' ); ?>
Note: The widget has a dropdown that allows you to select the relevant option.
Options for <PARA> are:
Notes:
If needed, content blocks can be used within other content blocks via shortcodes as described above. However, the parent content block must be called with shortcodes allowed within the "para" parameter (see above).
A safety feature has been written into the plugin to avoid circular references, which would cause an infinite loop. For example, if content block "A" is used in content block "B" and vice versa, the plugin will drop the second loop. This is true also of more complex scenarios such as content block "A" used in content block "B" used in content block "C" used in content block "A".
This plugin also provides the following useful shortcodes, which can be used within content blocks as well as other places such as pages/posts:
Date & Time:
(Using the standard PHP date format strings - see http://php.net/manual/en/function.date.php)
[ls_content_block datetime="<DATE/TIME FORMAT>"]
For example, the current date in dd/mm/yyyy format would be:
[ls_content_block datetime="d/m/Y"]
Site Title:
(As set in WordPress admin area - Settings > General)
[ls_content_block info="site-title"]
Title of Current Page/Post:
(Note that this is the raw title of the page/post and not the same as the title within the HTML <title> tag, which can be changed by SEO plugins)
[ls_content_block info="page-title"]