=== Plugin Name === Contributors: Loomisoft Donate link: http://www.loomisoft.com/make-a-contribution/ Tags: content blocks, text blocks, reusable content, reuusable content widget, reusable text, reuusable text widget, WPBakery, Visual Composer, Fusion Builder, Beaver Builder, SiteOrigin Page Builder, page builder, pagebuilder Requires at least: 3.0.1 Tested up to: 4.7.1 Stable tag: 1.1.0 License: GPLv3 or later License URI: https://www.gnu.org/licenses/gpl.html This plugin allows users to define modular blocks of text/content and place them in pages, posts, sidebars, etc. via shortcodes, widgets or PHP. == Description == 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. In a recent version the plugin was updated to support WPBakery's Visual Composer, Avada's Fusion Builder, Beaver Builder and SiteOrigin Page Builder. This version has been updated to give greater control over how content blocks are pre-processed before being rendered by providing a number of options as regards the "para" parameter. While full content filtering is necessary to allow comatibility with visual page builders, this causes plugins that are designed to insert content into posts and pages (e.g. author information blocks, social sharing buttons, etc.) to do the same with content blocks. In such cases, these insertions therefore end up being repeated more than once on a post page with a content block. = Features = * Uses WordPress custom post type and custom post management to define reusable content blocks * Allows the use of shortcodes, widgets and PHP to place content blocks into pages, posts, sidebars, widgetised areas or anywhere on your site * Provides greater control over the adding of paragraph tags, running of shortcodes or running complete content filtering * Provides a widget to place content blocks into sidebars and other widgetised areas * Supports WPBakery's Visual Composer, Avada's Fusion Builder, Beaver Builder and SiteOrigin Page Builder * Provides a number of other useful shortcodes to place dynamic text (e.g. date/time, site title, page title) into posts = Defining content/text blocks = 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. = Shortcodes = 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="full"] See section below for full options as regards this parameter. = Widgets = A custom 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. = Access via PHP = Content blocks can 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>*' ); ?> 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>*, 'full' ); ?> See section below for full options as regards this parameter. = Use with Visual page builders = This plugin continues to support WPBakery's Visual Composer, Avada's Fusion Builder, Beaver Builder, SiteOrigin Page Builder and possibly others (although others have not been tested). To use this feature, you will need to: * If relevant to the specific page builder, enable the "lscontentblock" or "Content Blocks" post type within its settings * For shortcodes, use the para="full" attribute as described below * For the widget, select "Full Content Filtering" from the "Content Filtering / Paragraph Tags" dropdown * In the case of PHP, set the second parameter to 'full' = The "para" parameter = The "para" parameter can be used within the content block shortcodes or PHP calls to control how content blocks are pre-processed before being rendered. The syntax is as follows: > [ls_content_block id="*<ID>*" para="full"] > <?php echo ls_content_block_by_id( *<ID>*, 'full' ); ?> In the above example, the value "full" has been used. Options are: * **None specified (default)** - Do not insert paragraph tags, but run shortcodes within the content block. Please note that when the shortcode is run, the resulting in paragraph tags being inserted in sub-content * **"no-shortcodes"** - Do not insert paragraph tags and do not run shortcodes. Please note that mark-ups set in the WordPress WYSIWYG editor (e.g. bold, underline, colours, headings, etc.) will still be shown * **"paragraphs"** - Insert paragraph tags and run shortcodes * **"paragraphs-no-shortcodes"** - Insert paragraph tags, but do not run shortcodes * **"full"** - Perform full WordPress content filtering. This option is necessary with the visual page builders. However, plugins that are designed to insert content into posts and pages (e.g. author information blocks, social sharing buttons, etc.) will do the same with content blocks causing their content to be repeated. If full content filtering is absolutely essential, but do not wish the third party plugin to insert additional content, you may be able to suppress this from within that plugin's settings. For example, StarBox, which inserts author information into posts and pages, has the option to "Hide Author Box from custom posts types". *Note:* For backward compatability the plugin interprets the old para="yes" option (or true in PHP) as para="full". = Content blocks within content blocks = If needed, content blocks can be used within other content blocks via shortcodes as described above. A safety feature has been written into this plugin to suppress circular references. To do this, the parent content block must be called with shortcodes allowed within the "para" parameter (see above). = Other useful shortcodes = 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"] == Installation == 1. Upload the plugin files to the '/wp-content/plugins/loomisoft-content-blocks' directory, or install the plugin through the WordPress plugins screen directly. 1. Activate the plugin through the 'Plugins' screen in WordPress 1. Full usage information may be found in Content Blocks > Usage & About == Frequently Asked Questions == = Are content blocks easy to add and edit? = Yes. Content blocks add the "Content Blocks" custom post type and use the WordPress native editor. = Can content blocks be placed anywhere on a site = Content blocks can be placed within post/page content, within sidebars, and other areas via shortcode, via widgets and via PHP. = Can content blocks be used in other content blocks? = Yes. The normal shortcode can be used. In fact, a safeguard function has been built into the plugin to avoid circular references, which would cause an infinite loop. For example, if content block "A" is referred to within content block "B" and vice versa, the plugin will drop the second loop. More complex scenarios such as content block "A" referred to within content block "B", which is in turn referred to within content block "C", which is then referred to within content block "A" are also suppressed. = Can visual page builders be used to create content blocks? = This version has been updated to supports WPBakery's Visual Composer, Avada's Fusion Builder, Beaver Builder and SiteOrigin Page Builder. To use content blocks with page builder content, you will need to: * If relevant to the specific page builder, enable the "lscontentblock" or "Content Blocks" post type within its settings * For shortcodes, use the para="full" attribute as described below * For the widget, select "Full Content Filtering" checkbox from the "Content Filtering / Paragraph Tags" dropdown * In the case of PHP, set the second parameter to 'full' In principle, other page builders may also work. However, they have not been tested. If you come across others we have missed, please let us know. == Screenshots == 1. List of "Content Blocks" custom post type 1. Edit screen for content block 1. Access details listed for Content Block 1. Widget for placing content block into sidebars, widget bars == Changelog == = 1.0.2 = * Launch version = 1.0.3 = * Added ls_content_block_by_id and ls_content_block_by_slug PHP functions = 1.0.4 = * Fatal error bugfix = 1.0.5 = * Updated to support visual page builders including WPBakery's Visual Composer, Avada's Fusion Builder, Beaver Builder and SiteOrigin Page Builder = 1.0.6 = * Bugfix with Beaver Builder integration = 1.0.7 = * Bugfix of broken code handling Visual Composer integration = 1.0.8 = * Bugfix with invocation of blocks by PHP * Addition of error trapping to ensure IDs are numeric = 1.1.0 = * Addition of greater options for the "para" parameter and how content is pre-processed before being rendered * General clean-up and improvements over code == Upgrade Notice == = 1.0.4 = Corrections and bugfixes = 1.0.5 = Updated to support visual page builders including WPBakery's Visual Composer, Avada's Fusion Builder, Beaver Builder and SiteOrigin Page Builder = 1.0.6 = Updated to fix issues with Beaver Builder integration = 1.0.7 = Corrected broken elements handling Visual Composer blocks = 1.0.8 = Corrected code relevant to invocation of blocks by PHP plus more stringent error trapping to ensure IDs are numeric = 1.1.0 = This version gives greater control over how content blocks are pre-processed before being rendered by providing a number of options with the "para" parameter to stop duplicate post insertions from other plugins (e.g. author information blocks or social sharing buttons plugins)