Пример #1
0
/*
* Initiate your taxonomy custom fields
*/
$my_meta = new Tax_Meta_Class($config);
/*
* Add fields 
*/
//text field
$my_meta->addText('extra_links_header', array('name' => 'Extra Links Header'));
//Image field
$my_meta->addImage('display_image', array('name' => 'Feature Image'));
//wysiwyg field
$my_meta->addWysiwyg('section_links', array('name' => 'Section Links '));
/*
* 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_meta->addText('re_text_field_id', array('name' => 'My Text '), true);
$repeater_fields[] = $my_meta->addTextarea('re_textarea_field_id', array('name' => 'My Textarea '), true);
$repeater_fields[] = $my_meta->addCheckbox('re_checkbox_field_id', array('name' => 'My Checkbox '), true);
$repeater_fields[] = $my_meta->addImage('image_field_id', array('name' => 'My Image '), true);
/*
* Then just add the fields to the repeater block
*/
//repeater block
//$my_meta->addRepeaterBlock('re_',array('inline' => true, 'name' => 'This is a Repeater Block','fields' => $repeater_fields));
/*
* Don't Forget to Close up the meta box deceleration
*/
//Finish Taxonomy Extra fields Deceleration
$my_meta->Finish();
Пример #2
0
 $prefix = 'ba_';
 /*
  * configure your meta box
  */
 $config = array('id' => 'demo_meta_box', 'title' => 'Demo Meta Box', 'pages' => array('category'), 'context' => 'normal', 'fields' => array(), 'local_images' => false, 'use_with_theme' => false);
 /*
  * Initiate your meta box
  */
 $my_meta = new Tax_Meta_Class($config);
 /*
  * Add fields to your meta box
  */
 //text field
 $my_meta->addText($prefix . 'text_field_id', array('name' => __('My Text ', 'tax-meta'), 'desc' => 'this is a field desription'));
 //textarea field
 $my_meta->addTextarea($prefix . 'textarea_field_id', array('name' => __('My Textarea ', 'tax-meta')));
 //checkbox field
 $my_meta->addCheckbox($prefix . 'checkbox_field_id', array('name' => __('My Checkbox ', 'tax-meta')));
 //select field
 $my_meta->addSelect($prefix . 'select_field_id', array('selectkey1' => 'Select Value1', 'selectkey2' => 'Select Value2'), array('name' => __('My select ', 'tax-meta'), 'std' => array('selectkey2')));
 //radio field
 $my_meta->addRadio($prefix . 'radio_field_id', array('radiokey1' => 'Radio Value1', 'radiokey2' => 'Radio Value2'), array('name' => __('My Radio Filed', 'tax-meta'), 'std' => array('radionkey2')));
 //date field
 $my_meta->addDate($prefix . 'date_field_id', array('name' => __('My Date ', 'tax-meta')));
 //Time field
 $my_meta->addTime($prefix . 'time_field_id', array('name' => __('My Time ', 'tax-meta')));
 //Color field
 $my_meta->addColor($prefix . 'color_field_id', array('name' => __('My Color ', 'tax-meta')));
 //Image field
 $my_meta->addImage($prefix . 'image_field_id', array('name' => __('My Image ', 'tax-meta')));
 //file upload field
Пример #3
0
 public static function metadata_customizations()
 {
     include_once PLS_Route::locate_blueprint_option('meta.php');
     //throws random errors if you aren't an admin, can't be loaded with admin_init...
     if (!is_admin() || !class_exists('Tax_Meta_Class')) {
         return;
     }
     $config = array('id' => 'demo_meta_box', 'title' => 'Demo Meta Box', 'pages' => array('state', 'city', 'zip', 'street', 'neighborhood'), 'context' => 'normal', 'fields' => array(), 'local_images' => false, 'use_with_theme' => false);
     $my_meta = new Tax_Meta_Class($config);
     foreach (self::$custom_meta as $meta) {
         switch ($meta['type']) {
             case 'text':
                 $my_meta->addText($meta['id'], array('name' => $meta['label']));
                 break;
             case 'textarea':
                 $my_meta->addTextarea($meta['id'], array('name' => $meta['label']));
                 break;
             case 'wysiwyg':
                 $my_meta->addCheckbox($meta['id'], array('name' => $meta['label']));
                 break;
             case 'image':
                 $my_meta->addImage($meta['id'], array('name' => $meta['label']));
                 break;
             case 'file':
                 $my_meta->addFile($meta['id'], array('name' => $meta['label']));
                 break;
             case 'checkbox':
                 $my_meta->addCheckbox($meta['id'], array('name' => $meta['label']));
                 break;
         }
     }
     $my_meta->Finish();
 }