WordPress Wednesday: An Introduction to the Custom Field Template Plugin

Geek Factor: 3

In this week’s WordPress Wednesday, I’m going to write about a plugin I can’t believe I haven’t covered yet: the Custom Field Template plugin by Hiroaki Miyashita.

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:

[html] [Favourite Fruit] type = checkbox values = apple # banana # orange [/html]

… select dropdowns:

[html] [Favourite Fruit] type = select values = apple # banana # orange [/html]

… and even use WordPress’ WYSIWYG editor:

[html] [Other Favourite Things] type = textarea rows = 6 cols = 50 tinyMCE = true htmlEditor = true [/html]

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!

  1. Rob Golbeck said:

    I hadn’t come across this plugin before, but I have a feeling it’s going to become invaluable for me now too. Thanks for the intro! 🙂

    For my own go-to plugins, WordPress SEO by Yoast and Contact Form 7 are definitely at the top of the list. I’ve used Custom Widget Classes on a couple of recent projects too, which has proved to be pretty useful.

    @ 9:32 pm
  2. Thanks for the recommendations, Rob!

    I, too, love Contact Form 7 — it’s another plugin I never seem to build a site without. I’ll have to check out WordPress SEO in more detail.

    One of my weird WordPress confessions is that I have never, ever used widgets (outside of editing them on sites I haven’t built). That’s probably something worth spending some time with, too 😉

    @ 9:48 am
  3. Jay Rijh said:

    Thank you for your writeup on Custom Field template. The documentation on this is so scant that it becomes a handicap in trying to use this plugin. Do you know any detailed documentation and/or tutorial on this plugin.

    I have a elementary question. I was able to create the fields in my post. I am trying to display the results in a widget on the post. However, I don’t know the shortcode syntax for displaying a field (say the field name is “Job Category”). What would be the cft syntax to display that field.

    @ 7:15 am
  4. Esther said:

    Hello Laurel!,
    I had installed Custom Field Template some weeks ago to my wordpress site. I had created a “custom page” that is showed at the left menu of my admin panel. I don’t use it, and I have decided to remove the plugin from my site, but the “custom page” is continue showing on the admin panel. Do you know how can I delete it? I see “Articles – Add Article” on the admin panel…
    Thank you very much!,

    @ 3:25 am

Leave a Comment

Note: Fields marked with a * are required; email addresses are not published.

Legal FAQ Collections