Are you fed up of copying and pasting the same old boilerplate text or code into your site? I know I was.
On my own blog I include a disclaimer on any post or page that features affiliate links. But it was getting really tedious copying and pasting that same old disclaimer from one post to the next. So I decided to find a solution to my frustration, and was lucky enough to come across Global Content Blocks.
A Simple Solution
With Global Content Blocks you can create content blocks – be it plain text, HTML, or PHP – and then insert them into any post or page (or in fact anywhere on your site) via a shortcode or button press. If you change the content block from within the plugin’s settings, the changes will apply site-wide. Not only can you save yourself time in copying and pasting, you can also retain control over the content blocks, should you wish to change them at a later date.
The potential uses and applications for this are practically endless. Obviously I am using it for my disclaimer, but you could also use it for AdSense code, mailing list signup forms, code snippets, iframes…the list goes on.
Once you have installed Global Content Blocks, all you need to do is create your content blocks, then call them from within a page, post, or elsewhere.
Head over to the plugin’s settings screen and select the “Add a New Content Block” option. You will be presented with the following screen:
First, give your content block a descriptive name (doing so will prevent the need for a description). Take a moment to select the type of content you will be creating – this will allow you to more easily identify content blocks when they are inserted within posts and pages.
Finally, just insert whatever content you want into the last text box, and hit “Save”. That’s it! You have created a content block. Here’s one I made earlier:
Inserting a content block into a post or page couldn’t be any easier. When the time comes, hit this button on your visual editor toolbar:
On the resultant screen, select your desired content block and then just hit “Insert Content Block”.
As you can see from the above screenshot, you can choose to insert the content itself, rather than the shortcode. If you do that, you will not be able to apply changes to that particular occurrence of the content block from within the plugin’s settings. Additionally, you can choose to create a new content block from this screen directly.
Once you have inserted the content block, your screen will look something like this:
Alternatively, you can insert content blocks into your pages and posts by typing the relevant shortcode (a list of which can be found in the “Manage Blocks” section of the plugin’s settings. An example would be [contentblock id=2].
Placing Content Blocks Elsewhere
You may wish to place content blocks on specific areas of your site outside of posts or pages. Fortunately, doing so is an absolute piece of cake.
Just insert the following code: <?php echo gcb(x);?>, and replace “x” with your desired content block’s ID (e.g. “2”).
How Would YOU Use This Plugin?
There are numerous potential usage applications for Global Content Blocks. What uses can you find for the plugin? Let us know in the comments section below!
Download Global Content Blocks here.