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.
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”.
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:
- Infinite number of content blocks
- Editable via the rich text editor
- Template code displayed in the admin area for simple copying and pasting into templates
- Turn the block “on” or “off” to show or hide depending on your needs
- Ability to add a HTML wrapper to your block. This lets you define elements that will only appear if the block is active.
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:
- Footer text, e.g. copyright notices
- Updating your “I’m available for work” section on your portfolio site
- Banners at the top of your site advertising a link or new site
- Sidebar lists, e.g. events you are attending
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.