I blogged recently about one of my favorite use cases for incorporating the WordPress Global Content Blocks plugin into my family history writing workflow — maintaining a library of reusable biographical profile boxes (what I call a Genealogy Snapshot Box) that I attach to each blog post about a particular ancestor or relative on my family history blog. In this post, I explain another favorite use case — maintaining a library of reusable Intro Blurbs for regular blog prompts, such as the 52 Ancestors in 52 Weeks blogging challenges in which I participated last year and am participating again this year.
Note that Global Content Blocks ONLY work on self-hosted WordPress.org-run sites.
Figures 1 and 2 show two of the most recent posts I have written for this year’s 52 Ancestors blogging challenge. Looking at these two posts, you can see that the Intro Blurb for both is almost identical. The only difference is the week number, the name of that week’s theme, and the ancestor number (which is always the same as the week number). This is true for all posts I have written in this blogging challenge series to date.
Initially, when I started last year’s challenge, I manually copied and pasted the intro text blurb into each new post, then swapped in the details for the current week’s prompt. That method seemed inefficient, and often led to mistakes — usually me forgetting to alter the week number of the ancestor number. So I decided to take advantage of the ability to reuse a default standard block of text through use of the plugin.
If you are trying to avoid unnecessary plugins (which I normally do) due to load time performance or security issues, you can accomplish this same scenario using conditional statements in the functions file of your child them that hinge on particular categories or tags. But since I am already heavily using the Global Content Blocks plugin for pretty much every post on my family history blog, I opted to stick with the plugin route.
Global Content Blocks
How to use the plugin and integrate it into your blog posts or pages.
Installing the Plugin
Download the plugin for the WordPress Plugin Directory. Install and activate as usual. But, as you should already do with every plugin, make sure you backup your WordPress database and files prior to installation. If you utilize caching plugins, make sure you clear that cache after activating the plugin.
Accessing the Plugin
Once activated, you will access the Global Content Blocks plugin settings from the main Settings menu of your WordPress dashboard [Figure 2].
Creating & Editing Blocks
From the Global Content Blocks settings, you can create a new content block or access your existing library of content blocks if you need to modify and update one.
The red arrow in Figure 4 shows you the “Add a New Content Block” button to click to create a new Intro Blurb block. This brings up a form with a WYSIWYG editor as show in Figure 6 (the Edit Content Block screen).
Editing and updating an existing content block works the same way, except instead of clicking on the “Add a New Content Block” button, look in the block library for the item you want to modify. Click on the item name, and this will bring up the Edit Content Block screen [Figure 6].
The Intro Template Block
The following example [Figure 6] illustrates the Intro Blurb template that I use for my 52 Ancestors in 2015 posts.
Unlike my Snapshot Box example, I use the standard WYSIWYG editor formatting instead of raw HTML code. The green arrows designate which pieces of content get modified inside of each each individual blog post (not here in the actual content block).
A quick look at the form fields in the Edit Content Block screen:
- Name (Short Title): I use a brief descriptive title.
- Custom Shortcode String: I leave this blank, and allow the system to generate a unique identifier shortcode.
- Type: I leave this on “General” for general formatted text.
- Description: I add a note, to expand upon the block’s purpose.
- Content: This is the formatted intro text.
With this Intro Blurb template saved in the Global Content Blocks library, I am ready to add it to all new post in the series. If you already started blogging a particular series, you can still go back in and add this type of Intro Blurb content block to those posts as well.
Using the Intro Template Block
From within the Edit view of the blog post to which you want to add the Intro Blurb, move your cursor to the beginning of the post. Look for the Global Content Blocks button in your WYSIWYG editor [Figure 7]. It looks like three multicolored blocks stacked together.
This year’s 52 Ancestors in 52 Weeks blogging challenge focuses on a different theme (as well as a different ancestor) each week, so I usually save the theme prompt for each week in the draft of that week’s post [Figure 7] as placeholder content until I add the Intro Blurb block.
Select the Block
Clicking on that Global Content Blocks button brings up a Global Content Blocks dialog box [Figure 8]. Since you already have your code block created in the Global Content Blocks library, you choose the first option, to “Insert Global Content Block”.
Note that you can actually create the new code block from this screen. I just always find it easier to create it first in the Global Content Blocks library, and insert it from this screen.
Once you click on the “Select a content block” drop-down menu, the dialog will display a list of your existing Global Content Blocks [Figure 9]. These are displayed in the order in which you created them, with the most recent at the bottom — not in alphabetical order. Click on the block you want to use. Your browser Find function can help with this.
The block name you selected should now be displayed in that “Insert Global Content Block” field [Figure 10]. If the correct name is not displayed, repeat the preceding steps.
Copy the Block Content
For the Intro Blurb, check the box that says “Insert full content” [Figure 10]. This is the opposite of the process we followed for the Snapshot Boxes use case, in which we left that check box blank. The reason we add the actual full content (vs. just inserting the content block shortcode) is that for each Intro Blurb, we want to create a one-off instance of the content block template for each post in which it is used. For the Snapshot Boxes, we wanted to insert the entire code and text block as-is, without making any modifications unique to just a particular post.
Now on the flip side, since we are orphaning each instance of the Intro Blurb for each applicable blog post, if you opt to change the Intro Blurb text down the road (or notice a misspelling), you will have to manually update the Intro Blurb text on every single post in which you already added it. Unlike the Snapshot Box example, making the change to the master content block will NOT automatically push that update out to every single post in which it is used.
After checking the “Insert full content” box, click on the “Insert Content Block” button to drop your copied content into the blog post. This takes you back to the normal blog post or page edit screen. Here you will see the contents of the Intro Blurb template [Figure 11]. This is different from what we experienced with the Snapshot Box use case, where we ended up here with just an icon representing the Global Content Block instead of actual text [Figure 12].
Finish the Post
Now it’s time to add in the pieces of Intro Blurb content that are unique to this new blog post — those bits of one-off content that are different from the standard repeating Intro Blurb template we imported from the Global Content Block. I add in the ancestor number, the week number, and the ancestor/relative’s name (Figures 11 and 13, note the green arrows). And remember that week-specific theme placeholder content I mentioned earlier (Figures 7 and 11, highlighted in orange)? I simply cut and paste that into the Intro Prompt text as well [Figure 13].
Save your draft as normal, then finish composing the rest of your post (Figure 14).
Can you think of other ideas for which you might want to utilize Global Content Blocks for regular blogging prompts or columns? How about:
- For the standard intro text to a regular post on your society’s blog profiling a particular member or volunteer each month?
- For the standard intro text to each post you are live-blogging covering a conference?
- For a standard list of 3-4 “Want to Learn More?” resource links listed at the bottom of each blog post about a specific topic?