On my hobby blog PortlandBrewpubs.com I have a listing of all the brewpubs in the Portland area. The list is pretty long (yes, its Beervana!) and quickly became a management headache to keep everything looking uniform. I was looking around for way to standardize all my posts and ended up fixing up my own solution that was both free, and supportable as near as I can tell.
I started using Custom Fields in WordPress for all of the interesting bits of information in my posts to keep it standard. I have one for all the useful Pub stats. Street address, website, phone number, hours, etc. This way I can fill in a value for each field and know I’m not missing anything. I then use the very handy plugin Get Custom Field Values to display the fields in my Post. In the beginning I had all the formatting for every post right in the post body. This worked pretty well until I wanted to change the layout, at which time I realized it was a pain to update my site. I would then have to go to every post and replace the body of the post content. With over 40 pubs in town I didn’t want to have to do that every time. I had to strategize a way to avoid this moving forward.
This is where I came up with the idea of using nested Custom Fields. The Get Custom Field Values Plugin has a great feature where you can call the field value from another post. Using this feature, I tried calling a field value from a standard ‘PostTemplate’ post that had the formatting I wanted to apply to all my posts. The body of each of my posts simply has this code in it and nothing else.
[ custom_field field=”PostTemplate_Top” post_id=”111″ limit=”0″ / ] (with the spaces removed before each of the opening and closing braces)
The nested shortcodes in the Custom Field of the PostTemplate call the local custom fields of each individual post, so that everything is dynamic. So anytime I want to update the layout of all my posts, I simply get the layout I want working, and update the PostTemplate Custom Field in my PostTemplate post and voila, everything is updating with a few clicks!
And there you have my version of the poor man’s WordPress Template.