Insert Reusable Content Anywhere On Your Site With Global Content Blocks

Insert Reusable Content Anywhere On Your Site With Global Content Blocks

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.

Getting Started

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:

Add a New Content Block

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:

Content Block

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:

Visual Editor Toolbar

On the resultant screen, select your desired content block and then just hit “Insert Content Block”.

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:

HTML Block

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.

Tom Ewer

Tom Ewer is the founder of WordCandy.co. He has been a huge fan of WordPress since he first laid eyes on it, and has been writing educational and informative content for WordPress users since 2011. When he's not working, you're likely to find him outdoors somewhere – as far away from a screen as possible!

10 Comments

  1. Melissa

    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):

    Requirements:
    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
    Other options:
    https://wordpress.org/support/topic/this-plugin-is-no-longer-supported-5/

  2. wsspoelstra

    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?

    Kind regards,

    Willem

  3. Hal Gatewood

    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/

    Thanks,
    Hal

  4. Andrés

    Hi again… I maked a mistake. “I have not advanced knowledge”

    Sorry

  5. Andrés

    Hi
    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

    1. Tom Ewer

      Author

      I’m afraid I don’t understand the question Andrés.

  6. Nick

    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?

    1. Tom Ewer

      Author

      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.

  7. Dan

    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.

    1. Tom Ewer

      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.

      Cheers!

      Tom

Leave a Reply

Your email address will not be published. Required fields are marked *

Over 65,000 WordPress professionals are already using ManageWP

Add as many websites as you want for free, no credit card required. Sign up and start saving time!

Have questions? Get in touch!

Over 65,000 WordPress professionals are already using ManageWP

Add as many websites as you want for free, no credit card required. Sign up and start saving time!



Have questions? Get in touch!

Over 65,000 WordPress professionals are already using ManageWP

Add as many websites as you want for free, no credit card required. Sign up and start saving time!



Have questions? Get in touch!

Over 65,000 WordPress professionals are already using ManageWP

Add as many websites as you want for free, no credit card required. Sign up and start saving time!



Have questions? Get in touch!