Have you heard about the WordPress plugin that seems to do nothing, but is installed on over 100,000 sites?
However, you would never realize how important CMB2 just by installing it from WordPress.org. When you install CMB2, it is invisible - your site will not change in any way.
CMB2 is short for "Custom Metaboxes", but that name probably doesn't help if you're new to WordPress development.
All-in-all, I think it's time for some explanations ...
What is a metabox?
If you're not sure what a metabox is, log into a WordPress site and create a post. You'll see metaboxes everywhere. Examples of metaboxes include "Publish", "Tags", "Featured Image", "Categories" and "Format",
Many plugins will add their own metaboxes. In fact, creating metaboxes is an essential task for many, if not most WordPress plugins ... this is how plugins collect and store your data.
For example, the UpStream project management plugin is built directly on top of CMB2 and uses metaboxes to collect information about tasks and bugs.
These metaboxes are what CMB2 helps you to create. CMB2 is a developer’s toolkit for building metaboxes for WordPress. These metaboxes can be added to posts, terms, users, comments, or can be used to create custom option pages.
How to install CMB2 for your plugin
If you want to build a plugin that relies on CMB2, you can install the plugin from WordPress.org. However, there are some problems with that approach, and you'll see those explained in this video take from the How to Develop WordPress Plugins class. Instead, we recommend that you add the CMB2 folder to your /includes/ folder. Download the UpStream files to see how the CMB2 files are located.
This second video continues after the installation and show you how to create your first metabox with fields:
Who's behind CMB2?
CMB2 was initially developed by WebDevStudios, a large WordPress agency. However, last month WebDevStudios joined two more agencies, Human Made, Zao, to collaborate on CMB2. The project now has it's own Github organization.
The launch post for the new CMB2 collaboration is worth a read. Not only does it give a lot of background on the project, but it also has a ton of useful links, including these:
CMB2 is not just a plugin, but so much more. There’s the CMB2 snippet library, as well as several CMB related custom field repos. You can do so much with CMB2
Getting started with CMB2
If you want to use CMB2, we obviously recommend the plugin development videos, but here are some more links to get you started:
- Official CMB2 website
- Basic usage instructions
- A very helpful CMB2 tutorial from Flywheel
- 5 useful tutorials on front-end output with CMB2
Here are some more plugins built with CMB2 (thanks to Justin Sternberg for the suggestions):
- DW Knowledge Base
- PDF Light Viewer
- Timeline Express
- Perelandra Sermons
- Sliced Invoices
- Google Maps Builder