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.

Table Of Content

  1. Features
  2. Screenshots
  3. Download and enjoy
  4. Get Started
  5. Documentation & Support
  6. Extending classes and scripts

License: the Meta Box Script for WordPress is distributed under GNU General Public License.

Meta Box Plugin 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:
Meta Box Script For WordPress - Basic Fields
Some advanced fields:
Meta Box Script For WordPress - Advanced Fields

Download and enjoy

Download From GitHub (latest development version)

Download From WordPress (latest stable version)

Fork me on GitHub

If you like it, please buy me a beer!

Donation

(or send via Paypal to email rilwis@gmail.com in case the donation button doesn’t work)

License: the Meta Box Script for WordPress is distributed under GNU General Public License.

Get 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

For more documentation, please see the 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. For example, you would implement it like so:
    array(
       'name' => 'Series: ',
       'desc' =>'Select a series',
       'id' => 'veda_content_series',
       'type' => 'parent',
       'parent_type'=>'veda_series'
    )

    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).

Get the code here

Sliders

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

Get the code here