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.
Would be great if you could update this post since this plugin is no longer available and Gutenberg offers something that has SOME of this functionality – but not all. Here would be my requirements (and where Gutenberg reusable blocks falls short):
1. Can nest blocks in blocks
2. Search and replace function will change something inside the blocks
3. Blocks are not treated as “new posts” – and will not add social media plugins or anything else designed for “end of posts”
4. Code has the “name of the block” – not just a number. So when using in a post, the block is called and not . I’ve tested the Guttenberg blocks and this is one of several issues I’ve found (others include having to add a new post to get to the blocks to edit or add, not being available in the left hand nav bar in WP the way a plugin is, blocks not working without the Gutenberg plugin, haven’t tested any of the above 3 criteria yet).
Text Blocks is an option – but you can’t nest blocks
But if you decide you don’t want that block inside all your post anymore, can you delete this block and will the shortcode for example ‘[block 1]’ also be deleted in the posts? Or when you change the name of one block will it also be changed on all the pages using that block?
I recently built something similar. It uses the default WordPress UI which means you don’t have to explain as much to your clients. If they can figure out adding posts, then they can figure out the reusable blocks of text. Check it out if you’d like: http://wordpress.org/extend/plugins/reusable-text-blocks/
Hi again… I maked a mistake. “I have not advanced knowledge”
I start by saying that I have advanced knowledge. The plugin is great but I think it would be better to add this … I wish to put at the end of all my posts encouraging text comment. As I have also put that same qtranslate translated text. Can you make that jump automatically each entry? As I use this plugin, but I avoid copy and paste at the end of the entry I add … Can automate even more?
thanks in advance
I’m afraid I don’t understand the question Andrés.
Interested in using this to block content and prompt viewers to subscribe to email list before viewing locked content. Is this a good plugin to use?
I’m not sure this is the best plugin for the job Nick — although no obvious candidate springs to mind, there are plugins that cater specifically to what you are looking for.
Sweet plugin. This is why I love WP. You search for a plugin to simplify workflow – and bang, there it is. I recently found a plugin to change the default “admin” username without editing the database. Love it.
It’s great, isn’t it Dan? I recently wrote an article here on the blog arguing that one of the reasons WordPress is the best CMS for the majority of people is simply because it is so well-supported. Other CMS’ cannot compete with the enormous extensibility options.