content-blocks-wpAs a user sometimes you may want to duplicate certain contents in more than one pages, One way is to manually paste the content everywhere and publish it. But the downside is, If you want to change something in your content then you get the burden of updating the same in every page you have pasted the content previously.

For example, You want to insert a line or two with affiliate links in some of your articles (not all, just few of your articles). You have manually inserted everywhere but then you came to know that the affiliate links needs to be changed. The only option you have now is to update every single page you have inserted the line.

So whats the solution ?

Imagine instead of inserting a line, You insert a short code which displays the content you wish to display and whenever the content changes it automatically reflected to every place you have inserted the short code. Thats what content blocks are all about.

Content blocks are custom post types just like an article or page, You can create a content block with any name and content then it will automatically generate a short code which can be used anywhere in the site to display the content.

Sounds interesting right ? lets implement it with just few steps.

Implementing content blocks

The following steps applicable to any WordPress theme, If you are using theme frameworks (like Genesis, Builder etc) then implement the steps in child theme.

  1. Download the Zip file and extract it. You will find two files
    • blocks.php
    • single-blocks.php
  2. Move the single-blocks.php to your root folder of your theme. If using Genesis or other frameworks then move it to root folder of the child theme.
  3. If your theme does not contain a folder called inc then create one called inc and move blocks.php file to that folder.
  4. Edit functions.php and add the following code right after the <?php tag.
 /* Blocks custom post type */

Thats it check your WordPress admin area and you will find new post type called “Blocks” in left sidebar.

How to use custom content blocks

  • To create a content block go to WordPress Dashboard >> Blocks >> Add New.
  • Name the block and insert the content as you normally do for posts/pages and hit Publish.
  • Now go to WordPress Dashboard >> Blocks >> Blocks and you will find short code for the created blocks. Copy the short code and use wherever ever required.
  • Note that you can control the name of short code by editing the block permalink.

Let me know your thoughts about this tutorial in comments section below.



  1. Max says

    Thanks a lot for the tutorial. This is exactly what I was looking for. The pulings in the wordpress dirrectory could not do it.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv badge