How to Create Reusable Content Blocks in WordPress

How to Create Reusable Content Blocks in WordPress

When editing the blog posts of your site, it is possible that you want to add the same content on all or multiple articles. In this case, you may want to make this special process easier and more efficient. Here, we’d like to introduce the simple steps about how to create reusable content blocks in WordPress.

In fact, the added block contents you’d like to embed into your posts are various. They can be the piece the textual paragraphs for the disclaimer notice and the general introduction, the lines of coding stuff and links, the special images for the infographic and many more. Whatever the repeating content is, the following method can help you save a lot of effort for adding it.

Utilize the Reusable Text Blocks Plugin

Here, you can make use of the Reusable Text Blocks plugin. By using it, you can generate the reusable pieces of contents and insert them into your posts, pages, widgets and themes easily. Here, we need to mention that this plugin will create a new custom post type of “text blocks”.

Create the Reusable Text Blocks

Here, you can create the text blocks after the plugin installation. No additional settings are required to set up. For this, you simply need to click the Text Blocks > Add New button.

Now, you can generate the content just like editing your common blog posts. Once finished, you need to click the Publish button. Note that you can create any kind of content as you like.

Text Blocks

This way, when going back to the All Text Blocks part, you can find all your reusable contents, along with their titles, the exclusive shortcode and the detailed texts.

Add the Content Blocks into Your Posts and Pages

To add the reusable blocks into your website, you should use the exclusive shortcode of each block. Note that you can put the shortcode at wherever you want the block to showcase. In addition, if you want to display it in the header or footer section of your site, you can also use the PHP code in the theme file.

Text Blocks Shortcode

In addition, there is a default widget offered by this plugin, which is named as Text Blocks Widget. Here, you can showcase the block in your sidebar section by choosing your target text block. Also, you can choose to add the paragraphs automatically and hide the widget title on the front-end.

Text Blocks Widget

Utilize the Infuse Plugin

The Infuse plugin is another option you can use to create and display the reusable pieces of contents on your WordPress site. Note that each block leverages the visual editor of WordPress and can be compatible with all the kinds of media. In this case, you can be free to add a block of textual content at the end of all your posts or showcase the email subscription form on the header of each webpage.

The biggest highlight of it is that the appearance of each content block is 100% customizable. Here, you can control the borders, background colors, margins and many more.

Generate the Content Block

Likewise, this plugin also does not require any advanced setup and configurations. You can directly click the Content Blocks > Add Content Block button upon the installation.

Here, you firstly need to enter the title for this block and edit the detailed content. Note that you can make use of both the visual editor and the text editor. In this case, you can create the multimedia content as you like.

Once finished, you can publish it actually. And then, this plugin will generate the exclusive shortcode that can be checked by clicking the Content Blocks button. You can embed this shortcode to any post or page you like for showcasing the reusable content.

Content Block Shortcode

However, if you are looking to set up some advanced display settings, you can continue the following steps.

Determine the Block Location

If you only want to display the block above, within or below the main content of your blog posts, the utilization of the shortcode is enough. However, if you want to showcase it on the header or the footer section, you need to set up for this part.

Here, you should specify the name of all the WordPress action hooks you are looking to display the block. The standard hooks of WordPress core include the wp_head and the wp_footer. In addition, you can select the existing hooks from your current plugins or themes.

Block Location

Customize the Block Appearance

By default, the appearance of the block is of the white background color and the dark text color. However, if you want, you can change the background color and select the text color between the options of the light scheme and the dark scheme.

Even, you can determine the exact margin and padding of the content block.

Block Appearance

Decide the Block Display

From this part, you can display the block at your homepage, all the posts, all the pages, the 404 pages, the search pages and many more all the times. By ticking the corresponding checkbox, you do not need to embed the shortcode into your pages one by one.

Block Display