Justin Tadlock’s new ButterBean post meta box framework was officially released this week. The framework allows developers to easily build a metabox with a tabbed UI to accommodate multiple fields. After roughly three months of beta testing, ButterBean is ready for use in projects. It can be dropped into a plugin or used as a standalone plugin.
“The framework was built to bundle with plugins that need a sweet UI for handling several meta fields,” Tadlock said in the release announcement. “It’s particularly useful with custom post types. It is merely an interface for metadata in the same way that the WordPress customizer is an interface.”
If you enjoy working with the WordPress Customizer API, then you may appreciate how Tadlock structured ButterBean. The PHP code for the framework was architecturally modeled after this API. The templating, however, uses Underscore.js.
“If you’re not a JavaScript developer, don’t worry,” Tadlock said. “Assuming you’re not building advanced custom controls that require custom JavaScript, you’ll never have to touch it. You can register everything in PHP.”
Tadlock said one of the most frequently asked questions about this project is why he didn’t simply opt to use one of the WordPress community’s existing metabox frameworks. He created ButterBean because none of them did exactly what he wanted.
“I needed a simple framework for quickly building out a user interface in some of my plugins,” Tadlock said. “I’d already been reusing some code for a while to handle this. So, I decided to rip it out and turn it into a full-fledged framework that both I and others could use. Other frameworks are cool and do a lot of things that I don’t need most of the time. In development, you should always use the best tool for the job.”
Tadlock borrowed some code ideas for the plugin’s media frame from John James Jacoby’s WP Term Images plugin. The tabbed interface design was inspired by WooCommerce. An interactive demo is available on the project page if you want to see how ButterBean’s UI compares to existing solutions.
According to the project’s GitHub page, Tadlock intends to keep it lean and flexible for those who want to bundle ButterBean with their plugins. Now that 1.0 has been released, he plans to roll out more tutorials and documentation in the coming days to help developers get started.
Great approach to metaboxes. I hope to see more usage of this to prevent metabox madness and further declutter the post edit screen.