The Custom Field Template plugin is one I’ve used on every site I’ve developed since discovering it. It takes WordPress’s Custom Field functionality (which I wrote a quick introduction to on the Greenhouse over a year ago), and basically adds a user-friendly interface to it.
Out of the box, the WordPress custom fields are a bit awkward; users have to manually add them to each post, and the values are only tracked in text fields. For users who are comfortable using WordPress, this is doable, though annoying and a bit convoluted; for those less comfortable, it can be extremely confusing.
The Custom Field Template allows you to create a ‘form’ out of the different custom fields you’d like to display on posts. Each of these forms group the different values together; you can also restrict a form template to only show for a specific post type (post, page or a custom type), a specific template, or even specific posts by ID.
One item I frequently use custom fields for is creating profiles on websites – for example, the profiles on the Stem website each have custom fields behind the scenes to help manage the data about each Stemployee and make customizing displays possible.
Here is the data for my profile, using the out-of-the-box custom fields:
Not too bad, actually. But what if a new profile was needed for the site? This is what the custom fields would look like in that case:
WordPress does save keys that have been used before for custom fields, which is great… as long as you have an idea what each of them does. It is functional, but hardly self-explanatory — I’d feel fine managing data like this myself, but would feel awful handing it over to someone else without detailed instructions. At this time, months after setting up those various custom fields, I can’t even remember what half of them are used for.
Enter the Custom Field Templates
Now here are the exact same custom fields, using the Custom Field Template plugin:
The Custom Field Template uses its own simple shortcodes to create form fields for custom field data — here is a shot of the Custom Field Template UI to give you an idea of what it looks like:
The Custom Field Templates can be set to use simple text inputs, like above; it’s also possible to use checkboxes:
type = checkbox
values = apple # banana # orange
… select dropdowns:
type = select
values = apple # banana # orange
… and even use WordPress’ WYSIWYG editor:
[Other Favourite Things]
type = textarea
rows = 6
cols = 50
tinyMCE = true
htmlEditor = true
Here is a quick example of the Custom Field Template plugin in action on Stem’s Lawblogs.ca directory. I’ve created a fake entry for the Greenhouse blog, and entered the details into the fields that were created (complete with several questionable Clawbies wins):
The output is then generated using the
get_post_meta() function (more about that in this WordPress Wednesday post about custom fields):
If you’re feeling adventurous, you can also incorporate PHP code into the Custom Field Template — unfortunately, this feature doesn’t have a lot of documentation, but if you know a bit of PHP it can be worth fiddling around with as you can add some handy automation. In my opinion, this is what really pushes this plugin from ‘helpful’ to ‘invaluable’ — I’ll be covering some examples of PHP we’ve paired with this plugin in the weeks to come.
Do you have a plugin that you can’t build websites without? Please share in the comments below!