Meta Box is one of the best WordPress plugins for adding custom fields and meta boxes. It launched in 2010, as the first custom fields plugin for developers. And until Dec. 2016, it has been downloaded 1,300,000+ times and had active installs 200,000+. Due to our survey, more than 90% users are developers who are satisfied with our functional plugins. But we still believe anyone can install Meta Box and benefit from it. So today we would like to show a general guide for WordPress beginners to enjoy Meta Box. And as for the developers, we hope you can get something useful here to minimize your work.
So let's dig in…
What are the Custom Fields?
Custom fields allow you to store additional information with each WordPress post. Ok – maybe that doesn't sound exciting, but they actually unlock a lot of awesome features. For instance, you could use custom fields to automatically add schema markup to your WordPress posts.
Many of your favorite plugins and themes are probably built, at least partially, on the power of custom fields. They just hide the custom fields behind slick interfaces. Rest assured, if custom fields went away, your WordPress life would be a lot more difficult.
Installing Meta Box
After you install the plugin, you won't see anything right away. You have to jump into your theme's code to get started. You need to add some code to your functions.php (Appearance → Editor → functions.php). Meta Box provides some sample code to get started:
WordPress Beginner Guide for Meta Box
Once you add that code, you'll see this when you add a new post:
These are custom fields added by Meta Box.
Meta Box also provides some code that will give you a deeper demo. If you add all that code to your functions.php, you can see a full demo of what you can do with Meta Box:
Beginner-friendly Extensions
Meta Box has 14 premium extensions and 6 free extensions to support users. The most popular plugin in 2016 is Meta Box Group, which aims to organize custom fields in the repeatable & multi-level group to reach the best structure and appearance. But now we want to introduce some beginner-friendly extensions.
META BOX BUILDER
It is a perfect extension for WordPress beginners to edit meta boxes and custom fields only by drag-and-drop with No PHP and coding skills.
When you install it, you'll see an interface like this:
As you can see, I'm creating a custom text field for guest authors. This way, instead of creating a new account for every guest author, you could just add their info via custom fields. Once I save the custom meta box, I see this on the post page:
Here's what I built after a little more tinkering:
There're ~43 custom fields you can easily add with Builder. You can also choose whether your new meta boxes should show up for posts, pages, or both.
So, if you're a non-developer looking to start adding custom fields to your site, you'd better have this extension. Otherwise, you'll need to learn some PHP.
META BOX GEOLOCATION
It makes the way easier to add address data to a post. Instead of having to enter each element of an address (which over a lot of posts would definitely add up), Meta Box Geolocation helps you to fill in the location information automatically and instantly, right after you type the beginning.
Watch it in action:
Meta Box Geolocation makes everything simple – no need to create a database or set up the Google Maps API yourself.
META BOX YOAST SEO
It is a free extension that allows you to get a more accurate content analysis score from Yoast. It does this by allowing Yoast to see content in custom fields.
By default, Yoast will only analyze the main content in your post. Therefore, if you use a lot of custom fields, you'll have an inaccurate score. The Meta Box Yoast SEO extension fixes this.
META BOX CONDITIONAL LOGIC
It is a premium extension that lets you simplify fields by easily applying conditional logic. See it in action:
For example, you could show different fields for physical vs digital products. Or any other use for conditional logic that you can think up.
META BOX SETTINGS PAGE
If you're a theme or plugin developer, I imagine this premium extension is built entirely for you. Meta Box Settings Page helps you create a detailed settings page using the Meta Box syntax. If I understand correctly, the extension should drastically cut down the time it takes you to create a user-friendly interface.
For example, here's a sample settings page for a theme:
It's user-friendly with good aesthetics.
They aren't the only extensions you can get for Meta Box. Here are the rest:
- Meta Box REST API (free) – put all custom fields' values into REST API responses
- Meta Box Admin Columns (premium) – add custom fields to admin screens
- Meta Box Term Meta (premium) – add metadata to categories, tags, or other taxonomy
- Meta Box Custom Post Type (free) – easily create and manage custom post types
- Meta Box Text Limiter (free) – Limit the number of characters or words that can be entered in a field.
- Meta Box Group (premium) – Organize things better with repeatable groups of custom fields
- Meta Box Template (premium) – Use templates to more easily define custom meta boxes and fields
- Meta Box Tooltip (premium) – add help information to custom fields with pretty tooltips. I imagine this is great for helping developers make their themes/plugins more user-friendly
- Meta Box Show/Hide (JavaScript) (premium) – toggle meta boxes on or off for different templates, formats or taxonomies using JavaScript
- Meta Box Tabs (premium) – makes it easier to create tabs for meta boxes
- Meta Box Columns (premium) – makes it easier to aesthetically display fields by putting them into a 12-column grid
- Meta Box Include/Exclude (premium) – lets you show/hide meta boxes by ID, template, taxonomy, or custom function
Meta Box Pricing and Documentation
The basic meta box plugin is 100% free. And all the premium extensions range in price from $19 to $29 for use on unlimited websites and one year of updates/support.
As for documentation – Meta Box is extremely well documented. The core plugin has tons of articles, and each extension is also thoroughly documented. If you're already familiar with PHP, you should be able to get up and running very quickly with the support docs Meta Box provides.
Final Thoughts
We know how important custom fields are to themes/plugins, and Meta Box allows you to implement them incredibly easily. As we've mentioned, Meta Box Builder extension does make work easy, even for non-devs, and the rest of the extensions mentioned above can also make your life a heckuva lot easier, so check it out!
I copied your code as I got it from the generator. I pasted the code into my custom post type php file. I can see the fields in my post type and I can enter data but when I save the data is not saved. I do not see an add_action( 'save_post', 'date_field'); in your code so how is the data saved in the database?
Please help so I can use this great plugin