<?php

$prefix = 'ivp_';
/* 
* configure your meta box
*/
$config = array('id' => 'frontpage_banner', 'title' => 'Frontpage Banner', 'pages' => array('page'), 'context' => 'side', 'priority' => 'high', 'fields' => array(), 'local_images' => false, 'use_with_theme' => true);
/*
* Initiate your meta box
*/
$my_meta = new AT_Meta_Box($config);
/*
* Add fields to your meta box
*/
//text field
$my_meta->addText($prefix . 'frontpage_banner_title', array('name' => __('Title', 'ivp')));
//select field
$my_meta->addPosts($prefix . 'frontpage_banner_lnk', array('post_type' => 'page'), array('name' => __('Link to page', 'ivp')));
//Image field
$my_meta->addImage($prefix . 'frontpage_banner_image', array('name' => __('Banner image', 'ivp')));
/*
* Don't Forget to Close up the meta box Declaration 
*/
//Finish Meta Box Declaration
$my_meta->Finish();
Esempio n. 2
0
  * Add fields to your 2nd meta box
  */
 //add checkboxes list
 $my_meta2->addCheckboxList($prefix . 'CheckboxList_field_id', array('checkboxkey1' => 'checkbox Value1', 'checkboxkey2' => 'checkbox Value2'), array('name' => 'My checkbox list ', 'std' => array('checkboxkey2')));
 //date field
 $my_meta2->addDate($prefix . 'date_field_id', array('name' => 'My Date '));
 //Time field
 $my_meta2->addTime($prefix . 'time_field_id', array('name' => 'My Time '));
 //Color field
 $my_meta2->addColor($prefix . 'color_field_id', array('name' => 'My Color '));
 //wysiwyg field
 $my_meta2->addWysiwyg($prefix . 'wysiwyg_field_id', array('name' => 'My wysiwyg Editor '));
 //taxonomy field
 $my_meta2->addTaxonomy($prefix . 'taxonomy_field_id', array('taxonomy' => 'category'), array('name' => 'My Taxonomy '));
 //posts field
 $my_meta2->addPosts($prefix . 'posts_field_id', array('post_type' => 'post'), array('name' => 'My Posts '));
 //add Code editor field
 $my_meta2->addCode($prefix . 'code_field_id', array('name' => 'Code editor Field', 'syntax' => 'php', 'theme' => 'light'));
 /*
  * To Create a reapeater Block first create an array of fields
  * use the same functions as above but add true as a last param
  */
 $repeater_fields[] = $my_meta2->addText($prefix . 're_text_field_id', array('name' => 'My Text '), true);
 $repeater_fields[] = $my_meta2->addTextarea($prefix . 're_textarea_field_id', array('name' => 'My Textarea '), true);
 $repeater_fields[] = $my_meta2->addCheckbox($prefix . 're_checkbox_field_id', array('name' => 'My Checkbox '), true);
 $repeater_fields[] = $my_meta2->addImage($prefix . 'image_field_id', array('name' => 'My Image '), true);
 /*
  * Then just add the fields to the repeater block
  */
 //repeater block
 $my_meta2->addRepeaterBlock($prefix . 're_', array('inline' => true, 'name' => 'This is a Repeater Block', 'fields' => $repeater_fields, 'sortable' => true));