Ways to Create Custom Meta Boxes in  WordPress

When you start to use WordPress as a CMS you begin to realize that one WYSIWYG area isn’t going to cut it. At that point you may start to explore the option of custom fields. They’re great, and they work well for handling small changes. But what happens when you need to have multiple WYSIWYG areas, or upload files, or manage content using other form fields like checkboxes, radio toggle’s or text inputs.

To do this you’ll need the power of custom meta boxes. There are many ways to create them; some involve the use of plugins and some don’t. I’m going to discuss a few of the way’s I’ve created custom write panels, and explain the ups and downs of each approach. If anyone has any suggestions please leave your thoughts as comments; they may be added to the post in the future.

WPAlchemy MetaBox PHP Class

WPAlchemy MetaBox ClassThe best method I have found, and the one I’ve chosen to use personally in my work, is to create meta boxes with PHP. I suggest using the WPAlchemy MetaBox PHP Class by Dimas Begunoff.

This PHP class allows you to easily create custom WordPress meta boxes with code and attach to them to specific areas in the WordPress admin using filtering.

Admin page filtering options

Wide range of input field options

The MetaBox Class separates presentation by providing a separate CSS file. This allows theme authors to easily customize the look and feel of their meta boxes.

The Lowdown

If you have a good understanding of PHP and you’re building an advanced theme with out of the box metabox management, I highly suggest using the MetaBox PHP Class in place of the plugins mentioned below, it’s more reliable and uses a superior code base.

Pods CMS

Pods is a CMS framework that lets you create, manage, and display your own content types. Don’t bother hacking blog posts into becoming something they’re not. With Pods, create entirely new data structures with only the fields you need.

Pods CMS is somewhat new to me, and was originally something I heard about on the WordPress Weekly Podcast. It has a 5/5 star rating with 23 ratings on the WordPress Plugin Codex and was developed by seasoned programmers with an in depth knowledge of the way data types should be stored in databases. As best described by the authors:

The idea behind Pods seems to have stemmed from the Drupal Content Construction Kit (CCK) and is very promising. It has a very strong development team, including Scott Kingsley Clark and Jonathan Christopher, and provides a better options for managing data in the WordPress database that is separate from posts, pages and post types.

The Lowdown

If your looking for advanced custom field management with a strong, fast backend that can scale then Pods is a great option.

More Fields

More Fields Custom Post Type and Write Panel ExampleMore Fields is the plugin that I’ve chosen to use for most of my custom field scenarios. It allows you to create your own “post type” to make the WordPress administrative interface more intuitive for less tech savvy users. By default WordPress has two “post types”, Pages and Posts. Any custom post type you create is based on either a Post or Page.

Let’s say that you wanted to create your own post type called Case Studies. If you select Page as the Case Studies post type, then any Case Studies you create will appear under the Case Studies menu as well as under the Pages menu. At this point you may be asking yourself, what’s the point? If your Case Studies show up under Pages and Case Studies what’s the difference.

The difference is that you can control what options show up on Case Studies side of things. You can remove the Excerpt, Send Trackbacks, Custom Fields, Discussion or Post Slug boxes. If you want to add your own custom write panels for Case Studies, you can create “Boxes” that have specific form fields in them. These fields include:

  • Single line text fields
  • Multi-line textarea fields
  • WYSIWYG editors (without the ability to upload images unfortauntely)
  • Checkboxes
  • Radio toggles
  • Selectable file list that will let you choose from the files uploaded by the main WYSIWYG editor for that specific page or post

These boxes become write panels and are visible only on post types you choose. It all sounds complex, I know, but I would highly recommend setting up a WordPress sandbox install somewhere and playing around with it. It’s truly very powerful.

The Lowdown

If your looking for an easy to setup alternative to Flutter that allows you to create custom post types then More Fields may be for you.

Custom Field Template

Custom "Additional Content" Field Expanded
Custom "Additional Content" Field Expanded

The Custom Field Template plugin is very similar to More Fields, and was the first plugin I explored for managing custom fields and write panels. It has it’s advantages and disadvantages.

Unlike More Fields, the Custom Field Template plugin does not provide the ability to manage “Post Types”. Any custom fields you create will show up for all Posts, or Pages, depending on how the plugin has been setup.

You can add a WYSIWYG editor with the ability to upload files; something you can’t currently do with More Fields.

If your interested in how you can setup the Custom Field Template on your site, check out my Advanced Content Management with WordPress Custom Field Templates tutorial post.

The Lowdown

If your looking for a rock solid way to add a custom write panels to your pages and posts, then Custom Field Template may be your guy.

WP-CMS Post Control

The WP-CMS Post Control allows you to completely customize how specific users view the WordPress administration pages. You can remove many features to avoid confusion, and simplify the interface for less tech savvy users. Personally I’ve found that is very useful and do this to a certain extent with the More Fields plugin. This plugin seems to provide far more control over the admin interface by allowing you to:

  • Force standard browser upload rather than the Flash uploader
  • Remove the revisions feature completely
  • Turn off the auto save feature
  • Create a message panel allowing you to show messages to authors.
  • Hide the Screen Options and Help dropdowns
  • Hide the Favorites dropdown
  • Hide the Dashboard QuickPress
  • Control the display post options like the preview button, permalinks, tags, categories, excerpts, trackbacks, custom fields, discussion, and comment & ping options
  • Control the display of page options like custom fields, discussion, comment & ping options and attributes.

The Lowdown

If the people using the WordPress admin on your site aren’t too technical, it may be a benefit to simplify the interface by removing certain options. You can use the WP-CMS Post Control plugin to easily do this.

Custom Write Panels using Functions.php

Custom Write Panels with Functions.phpLast but not least, is the home grown approach. For all of you out there that enjoy getting your hands dirty, you can create your own write panels without the use of plugins. Function Web Design has a great tutorial on how to do this. You can read it here: Tutorial: Creating Custom Write Panels in WordPress.

If your at all farmiliar with PHP development I would highly recommend exploring this approach. It may take more time up front but it will help you understand how these write panels are created and how the information inputted into them is saved. This information will help you solve problems in the future faster and more effeciently.

Related Articles

Meet the Author

Kevin Leary, WordPress Consultant

I'm a custom WordPress web developer and analytics consultant in Boston, MA with 17 years of experience building websites and applications. View a portfolio of my work or request an estimate for your next project.