-
Notifications
You must be signed in to change notification settings - Fork 88
Radio Field
bainternet edited this page Jan 2, 2013
·
4 revisions
#Radio Field
To add a radio field to your metabox simply use the addRadio
method of the metabox object:
$my_meta = new AT_Meta_Box($config);
$my_meta->addRadio('radio_field_id',array('radiokey1'=>'Radio Value1','radiokey2'=>'Radio Value2'),array('name'=> 'My Radio Filed', 'std'=> array('radionkey2')));
- ID : field id (string)
- options: array of key => value pairs for radio options (array)
- args: (mixed|array)
-
'name' => field name/label, (string) optional
-
'desc' => field description, (string) optional
-
'std' => default value, (string) optional
-
'validate_func' => validate function name, (string) optional
-
- reapeater: When adding this field to a repeater block set to true (default false)
$my_meta->addRadio(
'img_radio_field_id',
array(
'1' => '<img alt="Opt 1" src="images/align-none.png">',
'2' => '<img alt="Opt 2" src="images/align-left.png">',
'3' => '<img alt="Opt 3" src="images/align-center.png">',
'4' => '<img alt="Opt 4" src="images/align-right.png">'
),
array('name'=> 'My Image Radio Field', 'std'=> array('2'))
);
$saved_data = get_post_meta($post->ID,'radio_field_id',true);
echo $saved_data;