Introducing WP-Blocks

I am currently putting the finishing touches to a new WordPress plugin called “WP-Blocks”. It’s a simple idea but one that I hope WordPress users will find useful.

The Problem

For most situations the WordPress “post” or “page” is sufficient for our content needs. They allow us to create and edit, via the admin interface, our content easily. However sometimes I find myself wanting to edit text or images that I have “hard coded” into the actual WordPress template, content that doesn’t easily fit into the “post” or “page” paradigm.

In order to keep my source “controlled” this involved editing my template, committing it to Git and then uploading the template to my server. For a small text change it’s a heavy process. Enter “WP-Blocks”.

The Solution

This plugin will enable you to define an infinite number of “content blocks”. You will then be able to edit these blocks via the admin interface using the rich text editor we are all familiar with.

In order to output these blocks all you have to do is add one function call to your template, a one time addition.

For example, to output a content block called “footer-notice” we would add the following to our template:

<?php get_wp_block('footer-notice'); ?>


Here’s a quick roundup of what the plugin offers:

Potential Uses

I developed this plugin as I wanted to be able to edit the short biography in the sidebar. Here are some other ideas you could use it for:

Coming Soon

I am in the process of putting the finishing touches to the admin interface. This in itself is worthy of a post as it’s taken me some considerable time to wrangle the admin CSS into a usable form. I hope to release the plugin in the next few weeks.

If you would like to beta test the plugin please drop me an e-mail.


Keir, this sounds great :)
I’ve been plugging in custom blocks into WP for a while, usually hardcoded into the template, of course. Useful for certain situations but too rigid and quite useless in lots of others….
Sounds like your plugin will be perfect for all cases :) Looking forward to trying it out once it’s done :)
Good luck :)

Hey Pricsa,

Thanks for your comment. There’s just a couple of things to iron out and a bit of work on the admin side of things to go so it should be out soon. Hope you will find it useful.

hi keir, good one – definitely a shortcoming of WP. i’ve been using to do (what i think is) the same thing. how will it differ?

Hey Chris,

Thanks for your comment. Despite delving deep into the plugin lists I never came across this one! Essentially I think the main difference is that my version (by chance really) does not relate the block to any particular piece of content (i.e. a page or post). It’s intended to be used for things like sidebar messages and footers as opposed to helping solve the issues of multi column layouts. Put simply I think it’s a lot simpler.

That looks like a great plugin though and I will definitely check it out.

Hey Kier, good call on this plugin. I had this exact problem t’other day: solved it with a second loop query that pulled in content from a specific category. I like your approach better tho.

Hey Kier, I’ve been using this plugin which works in almost an identical way:

However, I’ve encountered loads of bugs with the way it functions, and the new rich text editor blocks are not identical to the native WordPress version.

It’s a great idea that you develop this, much needed indeed. I’d love to help Beta test when it’s ready. Please use my email from this comment to contact when ready if you’d like.


Hey Bill, Thanks for your comment. I actually did a really good search for a similar plugin but couldn’t find one which is why I wrote it. Subsequently I have been pointed to a few similar ones (like multiple-content-blocks). I think they are all a little different and I think mine is one of the simpler ones. I hope you find it useful, if you find any bugs do let me know.

I couldn’t get this worka at all, it just output some PHP directly into my HTML. I couldn’t understand until I checked the source code: your PHP files in the “controllers” and “inc” subdirectories use the short PHP tag of “<?" — this fails on some server setups. If you change these so that they start with "<?php" it works fine.

Once I got this working, I found it pretty cool. Can I make a couple of suggestions for enhancements?

1) Add an option to RETURN the content, so it can be used in a variable, rather than ECHOING immediately. I have a situation where I need to do a little processing on the returned content before displaying it.

2) Add an option for a “friendly” label for each of the WP-blocks list screen. At the moment, the label is the lower-cased slug and this isn’t as easy to read. For example, I have a WP-block slug of “next-film” — it would be nice for this to say “Next Film”

Cool little plugin, keep up the good work :-)

Hey Matt,

Thanks for trying it out first of all and secondly for the feedback. I think you must have downloaded one of the early betas as I have fixed the short tag issue.

The best version to go for now is the version in the WordPress plugin repository. Full details on where to find it are in this post

I like the idea of returning the idea, happy to add that in. I will likely default it to echo but have an option to return it too. Adding in the “friendly name” would be relatively straightforward but would require a database change. I’ll need to look at how WP handles migrations. Alternatively I could just unslugify the name – what do you think?

Hi Keir. That’s strange, I downloaded the version in the repository, directly through the Add Plugins page in my WP back end. It’s v1.2 Beta — this has the shortcodes problem in it.

Regarding slugs, I only mention it in case I were to use this plugin on a client site — I think friendlier label names would be required there. I don’t mind them being slugs on my own sites. But yes, perhaps if it’s possible just to “unslugify” (great word!) for label display, that would be cool.

Do you have a donations button? I can see this being very useful :-)

Hey Matt, that’s very strange. I did another sanity check and can’t find any shortcodes in the version I have and it looks to mirror what I checked in to the repository.

I have just pushed it again so if you wouldn’t mind letting me know if the problem persists that would be great. Was it a particular page that it happened on?

I don’t think “unslugifying” should be too hard, let me look into that as the next “feature”.

Thanks for the suggestion of a donate link, I have added one here:

Hi Keir. I tried updating to 1.3. It still has short PHP tags in your controllers/index.php file and inc/wpblocks.class.php files. If I run this version, I get the same problem as before: “do_action(); ?>” is output to the screen. I can manually fix up the short tags and the plug-in works fine after that.

Hey Matt, Humble apologies – you are spot on. I am not sure how I missed that and actually how it happened after I searched for them. That will teach me to code late an night. Thanks again for persevering. I have updated and resubmitted.

Sorry, still broken. The short PHP tag is still in “inc/wpblocks.class.php”.

Hey Matt, not sure why that didn’t commit earlier but I have reposted it and all looks well in the repo. Apologies again for the inconvenience.

No problem, glad to be of help. I see you added do_shortcode to this version, I’d hacked my earlier version to do that too :-)

Hey Matt, I popped the shortcode in as someone suggested it in the comments. It hadn’t occured to me but I imagine this could be quite useful :)

I am also thinking of adding in shortcode functionality to output blocks themselves, having looked at the docs it doesn’t look too complicated.

It’s breaking the admin menu. I can’t make the menu parents slide down. Also breaking the Help and page options sliders.
I think it’s a jquery conflict.

Hey Victor, Thanks for the feedback. Just to check you now using the plugin from the repository? Also if you could provide some further details such as your PHP version (it needs 5) and also what version of WordPress you are running I should be able to help further. I haven’t had any issues like this from other users but let’s see if we can’t solve it :)

I love this plugin. Thank you. I have been using the RB Internal Links plugin by Arron Woods which includes a button in the Visual editor for inserting internal links. However, when I activated the WP-Blocks plugin, the RB Internal Links button disappears.

Not sure if anyone else has had issues with this, but any ideas on how to get these to play well together?


Hey Robert,

Thanks for your comment. Firstly thanks for your kind words about the plugin, really great to hear that it comes in useful.

I have actually had a couple of reports about the plugin causing issues with other editor based plugins. To be honest the documentation I have found relating to the editor is a little thin on the ground but I have, as far as I know, asked the code to play nicely with other plugins but I think I am doing something wrong.

I’ll keep looking into it as I obviously want and need it to play nice with other plugins.

Hey! I can’t get your plugin to work at all! When I click WP-Blocks in the admin, it’s empty!? What to do? I’ve tried all other plug-ins, but they are not what I’m looking for, this plug-in would be perfect :)

Hey Keir

Definitely some problems with the plugin and the rich text editor. It seems to disable saving – but on a slightly intermittent basis….



Hey Mike,

I did experience some difficulties when I had a bunch of plugins enabled. When I stripped it right back and just enabled wp-blocks I couldn’t replicate the issue. Have you tried with just wp-blocks enabled?


I am using your plugin and only wish I could have been using it for the past few years because I made a couple other websites with WordPress where I would have loved to use this. Well, I am using it now and am so happy. However, the apostrophe (‘) does not work. It gives a \’ instead of a ‘ . Do you know why this is happening?

Hi Keir. I’m a school secretary and maintain our school website. We’ve been happily using WP Blocks for the past year. Now, suddenly, when we click on WP Blocks to edit the content, it comes up empty — blank screen. Please pass along any help if you can. As it is now, I cannot update the site, and our budget doesn’t provide for contracting with someone. Thanks so much!