Skip to content
mathetos edited this page Oct 11, 2014 · 6 revisions

#Input Field

To add an input field to your metabox simply use the addText method of the metabox object:

$my_meta =  new AT_Meta_Box($config);
$my_meta->addText('text_field_id',array('name'=> 'My Text '));

Method arguments:

  • ID : field id (string)
  • args: (mixed|array)
    •  'name' =>  field name/label, (string) optional
      
    •  'desc' =>  field description, (string) optional
      
    •  'std' =>   default value, (string) optional
      
    •  'style' => custom style for field, (string) optional
      
    •  'validate_func' => validate function name, (string) optional
      
    •  'class' => custom class name added to the default (at-text)
      
  • repeater: When adding this field to a repeater block set to true (default false)

Get Field Data:

$saved_data = get_post_meta($post->ID,'text_field_id',true);
echo $saved_data;