Download Global Content Blocks.

 Major update v2.0 released – click here to see summary of new features 

As featured on ManageWP (see review/tutorial)

  • Do you use the same code snippets in multiple pages and posts?
  • Do you add forms, opt-in boxes, Adsense code and other HTML to your content?
  • Are you fed up with the WordPress editor stripping out your code, changing your formatting or adding in extra line breaks?

Then Global Content Blocks is for you!

A solution so simple it’s amazing that it hasn’t been done before!

Global Content Blocks allow you create your own shortcodes to add code snippets or HTML including forms, optin boxes, iframes, Adsense code, etc, to pages and posts. They are ideal for inserting reusable objects or to prevent the WordPress editor from stripping out your code or otherwise changing your formatting. Please let me know of any other uses you find for it by adding a comment below.

Here’s how easy it is to use Global Content Blocks…


Summary of new features in Global Content Blocks v1.5

  • Added visual editor when creating content blocks
  • Can now use variables within content blocks
  • Added ability to insert PHP blocks into content
  • Option to insert to entire content block into pages/posts instead of the shortcode
  • Option to select the block type, each represented by a different image block when inserted into content making it easier to identifyon the page
  • Added export function to export all or selected content blocks to an xml file that can be imported into the Global Content Blocks plugin on another WordPres site
  • Added a link to the Settings page from the Plugins page listing
  • Added hook to run scripts in functions.php file on output
  • Shortcode to use Content Blocks in widgets and non-post/page content


Download Global Content Blocks


Search the FAQ:

AWESOME. I was right on the edge of learning to write plugins just to have this functionality. In answer to the question "How big a content block can I add?", there is a workaround for the 64k limit: include_once "myVeryLongFile.php"; I've used this technique successfully on the homepage of the website noted above to select the appropriate, date specific ad next to the slideshow. Well done.
Mar. 27, 2011 by william morris, Missouri
Thanks for the tip William :-)

Can I use content blocks in a widget?
Jan. 2, 2011 by Ben
Yes, by adding the following lines in your theme's functions.php file you will be able to use content blocks in a text widget:

// use Global Content Blocks in widgets
add_filter( 'widget_text', 'shortcode_unautop');
add_filter( 'widget_text', 'do_shortcode');

Just add them at the end of the file before the closing ?>

Can it be completely uninstalled?
Dec. 26, 2010
Yes, there is an option to delete the database table if you want to completely remove the plugin.

Hi Ben -- thank you, terrific plugin! Is more documentation available than what's on this page? In particular, I'd like to know what the types 'General' and 'Code' are used for (code=js?). Thank you for any info! --Ariel
Mar. 17, 2011 by Ariel, Toronto, Canada
Hi, the types are simply to help identify the block when added to a page/post in case there are multiple blocks. It doesn't actually make any difference to the use of the plugin.

Hi Ben Really like your plugin. Do you think it would be possible to add the functionality of being able to nest blocks. i.e. create a block which has one or more shortcodes to include other [child] blocks. Does that request make sense to you? I appreciate there may be 'problems' associated with this approach i.e. a never ending loop!!! Would welcome your thoughts. Regards David
Jan. 26, 2011 by David
Hi David, interesting concept. Yes, it does make sense but because of the way GCB is designed, i.e., with each block being a self-contained shortcode as opposed to an opening and closing tag with content in between, I don't see any way that this could be done. You would probably have to create a block with your complete nested content although this would not give you the flexibility to change the contents on the fly.

I don't think it's what you're trying to achieve but you can create a block with a number of stacked shortcodes, e.g.,
[contentblock id=8]
[contentblock id=9]
[contentblock id=10]
and if this block is inserted into a page/post using the 'Insert full content' option, the individual blocks will all be displayed.

How big a content block can I add?
Dec. 22, 2010 by Ben
The content block will hold up to 64,000 characters.

How can I add the code from a Google adsense block so that it appears at the top left corner of every page or post automatically?
Jan. 17, 2011 by Kevin Foulds, London
That is beyond the scope of this plugin. There are however several excellent Adsense plugins that will do this.

I cannot get this plugin to function properly on a WP Multisite installation. I had it showing up in the visual editor at the start. I could open the plugin by clicking it's icon and was able to enter the information; name, description, and content. But it would not save the content. I exported the main sites content blogs but WP would not import them correctly into the new wp network site. Will this plugin work on WP Network Sites?
May. 3, 2011 by Steve R
Answer submitted by the poster:
I figured this problem out on how to make your plugin work reliably with WordPress Multisite.
1)Install the Unfiltered HTML Plugin from Wordpress. After installing in Multisite and activate.
2)Create a mu-plugins directory in the wp-content folder
3)Move the unfilted-mu folder from wp-content/pluigins to wp-content/mu-plugins
4)From the Network admin Plugins screen use network reactivate 5)As Network Admin go to the networked site and use Global Contents Block as normal.

When I built my content blocks I chose Code and copied my iframe data into the content area and save the content. From the visual editor I would select the content block to insert and it worked fine.

This worked for me twice and has not been tested thoroughly but I do have your plugin working reliably on one networked site.

Will I lose my content blocks if I change the theme or upgrade WordPress?
Dec. 22, 2010 by Ben
No, the blocks are added to the WordPress database so are independent of the theme and unaffected by WordPress upgrades.

Incoming search terms:

  • WPXpert
  • Content Blocks
  • NULL
  • wpxpert com
  • wordpress