Metakit is a fork of a project by: tammyhart
- Fixed the "manage" link bug
- Image and file upload buttons now use the new 3.5 media uploader!
- Text Input (types: text,tel, email, url, number)
- Textarea
- WYSIWYG Editor
- Single checkbox
- Select and Chosen select with support for "multiple"
- Radio group
- Checkbox group
- Taxonomy Select box and Checkboxes
- Post select with support for "multiple" and Chosen
- Post Checkboxes
- jQuery UI Date input
- jQuery UI Slider
- Farbtastic color chooser
- Post Drag and Drop Sort
- Image upload/select
- File upload/select
- Sortable Repeatable area with ability to use any of the above mentioned fields (with caution and reason)
Not all fields are covered in the included example, but they are in the Wiki
These files are written from the perspecitve of being used in a theme.
- Add the metaboxes directory in your theme or plugin.
- Include metaboxes/meta_box.php in your functions.php.
- Use the class to create and add meta boxes to any post type (see Examples section below or the Wiki )
Create an array that contains the field data (full examples of each filed type found in inc/sample.php)
$prefix = 'sample_';
$fields = array(
array( // Text Input
'label' => 'Text Input', // <label>
'desc' => 'A description for the field.', // description
'id' => $prefix.'text', // field id and name
'type' => 'text' // type of field
),
array( // Textarea
'label' => 'Textarea', // <label>
'desc' => 'A description for the field.', // description
'id' => $prefix.'textarea', // field id and name
'type' => 'textarea' // type of field
)
);
/**
* Instantiate the class with all variables to create a meta box
* var $id string meta box id
* var $title string title
* var $fields array fields
* var $page string|array post type to add meta box to
* var $js bool including javascript or not
*/
$sample_box = new custom_add_meta_box( 'sample_box', 'Sample Box', $fields, 'post', true );