Skip to content
bainternet edited this page Jun 15, 2012 · 1 revision

#Color Picker Field

To add an Color Picker field to your metabox simply use the addColor method of the metabox object:

$my_meta =  new AT_Meta_Box($config);
$my_meta->addColor('color_field_id',array('name'=> 'My Color picker'));`

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
      
  • reapeater: When adding this field to a repeater block set to true (default false)

Get Field Data:

$saved_data = get_post_meta($post->ID,'color_field_id',true);
echo $saved_data;
Clone this wiki locally