Themergency fooplugins.com

WordPress Meta Box Roundup

| 2 Comments

Meta boxes are used in the WordPress admin area to capture information pertaining to the post or page (or custom post type) you are editing. The cool part about these meta boxes is that you can add your own very easily, using the add_meta_box function. (I am not going to go over how to use this function or the parameters passed in, as this has been done in other posts listed below. For the coders out there, check out the source code for this function.)

The uncool part (for some) is adding the fields that you need to capture to the meta box. To do this you need to know HTML and PHP and you need to know how to hook into specific WordPress actions so you can validate and save the data. So basically, you need to be a coder if you want to create your own meta boxes from scratch.

Meta Box Tutorials

There are dozens of tuts and posts out there running you through how to add your own meta boxes. This makes it a bit easier to do it yourself, but you still need to know HTML and PHP code.

  • How To Create Custom Post Meta Boxes In WordPress (wp.smashingmagazine.com) - Probably one of the best tuts available on the subject written by Justin Tadlock.
  • Integrating With WordPress’ UI: Meta Boxes on Custom Pages (wp.tutsplus.com) - A very nice and clear tut on adding your own meta boxes. If you are doing this for the first time, then start here.
  • WordPress Meta Boxes: A Comprehensive Developer’s Guide (themefoundation.com) - An extremely detailed post about creating meta boxes from start to end. The whole process can be found in this post.
  • Ultimate Guide to Meta Boxes in WordPress (wproots.com) - Another very detailed tut on adding you own meta boxes from start to end.
  • How to Add a Fully Functional Custom Meta Box to WordPress Navigation Menus (johnmorrisonline.com) - walks you through how to add meta boxes to the WordPress navigation menu interface.

WordPress Meta Box Frameworks

WordPress Meta box frameworks have been written to handle all the hard work for us, and allows us to create complex capture forms with very little code. Some frameworks to check out are:

WPAlchemy MetaBox Class

Find the framework here: http://www.farinspace.com/wpalchemy-metabox/

One of the most popular WordPress meta box frameworks available. What makes it so popular is the documentation and videos that support the framework. The developer has also made it an extremely easy framework to use from a coding point of view. If you are not so confident with your coding skills, then this is the meta box framework to start with.

Customer Metaboxes and Fields for WordPress

https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress

Also know as CMB, this framework was coded by some of the most respected names in the WordPress community and supports over 20 field types. Definitely one of the more popular WordPress meta box frameworks out there. Check out this bit of code to see how you add it to your theme or plugin.

HM Custom Meta Boxes For WordPress

https://github.com/humanmade/Custom-Meta-Boxes

Originally a fork of the above CMB framework. What I love about this framework, is that the guys behind it (Human Made) have included a simple layout engine, so you can align fields within a 12 column grid. It also supports repeatable and grouped fields for your more complex meta box needs. Check out their Wiki for detailed documentation and code examples.

My-Meta-Box

https://github.com/bainternet/My-Meta-Box/

Another meta box framework maintained by the well known WordPress developer bainternet. Also check out his blog post about using the framework.

Field Manager

https://github.com/alleyinteractive/wordpress-fieldmanager

A really promising looking framework that allows you to add complex repeatable data forms with minimal code. Check out their homepage for an example.

Reusable Custom WordPress Meta Boxes

https://github.com/tammyhart/Reusable-Custom-WordPress-Meta-Boxes

This framework started out as a tutorial series on wptuts+, but the author decided to improve the code and turn it into something everyone could use as a framework. Unfortunately, the framework is no longer supported by the author, but is still a good framework to check out nonetheless.

WordPress Meta Box Plugins

There are a lot of plugins that help you add your own meta boxes without having to write a single line of code:

  • Meta Box - a very popular plugin for creating custom meta boxes. You can also view the project page or fork the code on github.
  • Advanced Custom Fields - a very poweful plugin for creating amazing edit forms. Add-ons are also available.
  • Easy Custom Post Types - provides an extremely easy to use and intuitive interface for creating custom post types, taxonomies, and meta boxes.

Additional Resources

It is always wise to consider (and implement) good security practices when coding in WordPress, especially when user input is involved! Read the Codex’s Data Validation as a way to ensure your custom WordPress meta boxes are secure.

The free IM8 Box Hide plugin allows you to show and hide certain meta boxes based on roles and capabilities.

Final Thoughts

WordPress Meta boxes are awesome. Gone are the days when you have to add specific custom fields to posts to change your site’s functionality. With the above resources, there is nothing stopping you from creating an amazing user experience within the WordPress backend. Will a meta box framework be built into WordPress core in the future? Let’s hope so. This trac ticket makes me think it will.

Also check out current questions related to meta boxes on stack exchange. Stack Exchange is a very valuable resource when it comes to learning how to code in WordPress.

Please let me know of any good frameworks I have left off this list and I will add them.

 

2 comments
  Livefyre
  • Get Livefyre
  • FAQ
purabdk
purabdk

This is nice help for creating meta box. I found another link which is helpful for upload file through meta box.

http://wordpressapi.com/file-upload-with-add_meta_box-or-custom_post_type-in-wordpress

NaifAmoodi
NaifAmoodi

Good job creating this list. I would recommend you to add the following plugin to your list: http://wordpress.org/plugins/fields-framework/