
This WordPress helper will let you create Meta Boxes fast with the flexibility you need as a developer. Full documentation walks you step-by-step. Create custom WordPress Meta Box UI elements for your projects with ease.
My wordpress meta box creation code is progressing and I would like to share my latest rendition with you. If you haven’t been following the series of articles about custom wordpress meta box creation and manipulation thus far, take a little bit of time and review (but come back to this page, as this is the latest and greatest code base):
- How to Create A Custom WordPress Meta Box Instead of Using WordPress Custom Fields
- How to Limit the Display of a WordPress Meta Box
- How to Keep the Custom Fields Area Uncluttered When Using a WordPress Meta Box
I hope you’ve been learning along with me and creating some nice UI elements in WordPress for yourself and your clients. This article should take your code to the next level.
Making WordPress MetaBox Creation Easier
WordPress makes it really easy to make tweaks pretty much anywhere you want. However, unlike some methods in wordpress, creating a meta box gets a little bit more involved. This helper class is an effort to try to simplify the creation of your meta boxes. Lets dive right into the code:
You would do the following in your functions.php file:
include_once 'WPAlchemy/MetaBox.php';
// include css to help style our custom meta boxes
if (is_admin()) wp_enqueue_style('custom_meta_css',TEMPLATEPATH . '/custom/meta.css');
$custom_metabox = new WPAlchemy_MetaBox(array
(
'id' => '_custom_meta', // underscore prefix hides fields from the custom fields area
'title' => 'My Custom Meta',
'template' => TEMPLATEPATH . '/custom/meta.php'
));
// add a second custom meta box
new WPAlchemy_MetaBox(array
(
'id' => '_custom_meta2',
'title' => 'My Custom Meta #2',
'types' => array('page','events'), // added only for pages and to custom post type "events"
'context' => 'normal', // same as above, defaults to "normal"
'priority' => 'high', // same as above, defaults to "high"
'template' => TEMPLATEPATH . '/custom/meta2.php'
));
Thats it! The above code shows the basic definition needed to setup a custom meta box (or more than one if needed).
Read the Documentation and Download
The WPAlchemy_MetaBox PHP class is fully documented and the latest version can be downloaded from GitHub.

Hello as they are, I wonder if it is possible to show metaboxes blocks in a form of publication created to run from the front-end and not the administration, meaning that in this form can be shown my mteabox where the user can select or mark the different options.