Meta Box Script For WordPress

Meta Box Script for WordPress is a WordPress plugin that provides an API for you to easily implement multiple meta boxes in editing pages in WordPress. It works with custom post types and supports various field types.

Project Page | GitHub | Documentation | Support | Donate

License: the Meta Box Script for WordPress is distributed under GNU General Public License. You can use this plugin in commercial products as well.

Features

  • Allow to create multiple meta boxes
  • Support various field types, including: text, textarea, checkbox, checkbox list, radio box, select, wysiwyg, file, image, date, time, color. Developers can easily add more types by extending the script
  • Work with custom post types. Each meta box can be defined for many custom post types.
  • Written in OOP, allow developers easily extend the script

Screenshots

Basic fields:

screenshot 1 Meta Box Script For WordPress

Some advanced fields:

screenshot 2 Meta Box Script For WordPress

Download

Download From GitHub (latest development version)

Download From WordPress (latest stable version)

Donation

This plugin has cost me countless hours of work, if you use it, please donate a token of your appreciation!

btn donate LG Meta Box Script For WordPress

Getting Started

To start using the meta box plugin, you need to download and extract it into the plugin folder, then activate the plugin via Plugins menu in WordPress

The downloaded package includes a demo folder, which contains a demo.php file. To run the demo with your theme:

  • Copy demo/demo.php file to your theme folder
  • Open functions.php file of your theme and add the following code at the top of the file:

    include ‘demo.php’;

Go to Add New Post page and see the result

See more documentation.

Extending Classes

This section will show extending classes, made by our contributors. You might found a class that fit your requirements.

Advanced Meta Box Class

This class is developed by Manny Fresh. The extending class follows all instructions above and this is a good reference for those who want to extend the class.

According his comment:

  • Added a get_meta_{$type} system, similar to how you had show_field_{$type} functions. This allows you to do a number of things: pre-format metadata before you display it or pull data from other sources other than the custom fields/ postmeta table.
  • Taxonomy type. Extended from original version. It uses a custom get_meta_taxonomy to pull terms from the taxonomy system. It also uses jQuery to support hierarchical taxonomies.
  • Rehauled the image system. Now you don’t need to save the images as metadata: I created a get_meta_images function that does a query of all the attached image ids and returns that as the meta.
  • Added get_field_name and get_field_id functions. You could change the way you set the name or id attributes of your fields so you could support more complex meta boxes, like ones that pull data from multiple other posts of different post types.
  • Parent type allows you to set the post_parent of a post, creating a hierarchical structure across multiple post types. The parent_type is the custom post type of the parent you want. It then gives you a select field that lets you pick from a list of all the posts of that type. The one you pick gets stored in the post’s post_parent field in the wp_posts table automatically. Cool part is that WordPress saves it automatically because the field’s name is post_parent. No save function required.

Download Here

Add menu select box

This code is written by Asafche. Actually, it’s not a class. It’s just an additional method for new field type. But it worths a try (if you need it, of course).

Download Here

Sliders

Pippin Williamson wrote this extended class that help users to create Sliders. Refer to his comment to know how to use it.

Download Here

Feedback and Suggestion

Welcome any feedback and suggestion to this plugin. You can send me (in the Support forum) some bugs of the plugin, new feature request, or any problem, occurring when you’re using it.