Exemplo n.º 1
0
  * Add fields to your meta box
  */
 //text field
 $my_meta->addText($prefix . 'text_field_id', array('name' => 'My Text '));
 //textarea field
 $my_meta->addTextarea($prefix . 'textarea_field_id', array('name' => 'My Textarea '));
 //checkbox field
 $my_meta->addCheckbox($prefix . 'checkbox_field_id', array('name' => 'My Checkbox ', 'desc' => 'field description'));
 //select field
 $my_meta->addSelect($prefix . 'select_field_id', array('selectkey1' => 'Select Value1', 'selectkey2' => 'Select Value2'), array('name' => 'My select ', 'std' => array('selectkey2')));
 //radio field
 $my_meta->addRadio($prefix . 'radio_field_id', array('radiokey1' => 'Radio Value1', 'radiokey2' => 'Radio Value2'), array('name' => 'My Radio Filed', 'std' => array('radionkey2')));
 //Image field
 $my_meta->addImage($prefix . 'image_field_id', array('name' => 'My Image '));
 //file upload field
 $my_meta->addFile($prefix . 'file_field_id', array('name' => 'My File'));
 //file upload field with type limitation
 $my_meta->addFile($prefix . 'file_pdf_field_id', array('name' => 'My File limited to PDF Only', 'ext' => 'pdf', 'mime_type' => 'application/pdf'));
 /*
  * Don't Forget to Close up the meta box Declaration 
  */
 //Finish Meta Box Declaration
 $my_meta->Finish();
 /**
  * Create a second metabox
  */
 /* 
  * configure your meta box
  */
 $config2 = array('id' => 'demo_meta_box2', 'title' => 'Advanced Meta Box fields', 'pages' => array('post', 'page'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(), 'local_images' => false, 'use_with_theme' => true);
 /*