Skip to content
Matt Cromwell edited this page Aug 30, 2014 · 1 revision

Number Field

To add a number field to your metabox simply use the addNumber method of the metabox object:

$my_meta = new AT_Meta_Box($config); $my_meta->addNumber('number_field_id',array('name'=> 'My Number Field '));

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
  • 'step' => the increment which numbers will rise/fall when clicking the up or down arrows in the field
  • 'min' => the minimum number for this field
  • 'max' => the maximum number for this field

Get Field Data:

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

Clone this wiki locally