复选框checkbox

复选框checkbox即<input type="checkbox">标签。

范例:

  1. $ashu_meta[] = array(
  2.   'name'    => 'Checkbox Example',
  3.   'id'      => 'checkbox_example',
  4.   'desc'    => 'Which fruits do you like?,Default are apple and orange.',
  5.   'std'     => array('apple','orange'),
  6.   'subtype' => array(
  7.     'apple'  => 'Apple',
  8.     'orange' => 'Orange',
  9.     'banana' => 'Banana',
  10.     'lemon'  => 'Lemon'
  11.   ),
  12.   'type'    => 'checkbox',
  13.   'multiple'    => false
  14. );

范例2:

  1. $ashu_meta[] = array(
  2.   'name'    => 'Checkbox Example2',
  3.   'id'      => 'checkbox_example2',
  4.   'desc'    => 'Please select some tags',
  5.   'std'     => '' ,
  6.   'subtype' => 'post_tag',
  7.   'type'    => 'checkbox',
  8.   'multiple'    => false
  9. );

详解:

name - 自定义字段标题

id - 自定义字段名称,获取数据时用。敬告:请确配置文件中所有id都不相同,同时避免post\page\title等词。

desc - 自定义字段描述信息

std - 数组,默认选中,由于复选框可以选择多个,所以该参数使用数组(数组中的值请设置为buttons中存在的)

subtype - 数组或字符串,即选项。注意真正保存的数据为数组的键名,即范例中的英文male\female,键名请避免中文,该参数设置为page、category(或自定义分类法名称)、nav_menu、sidebar时会自动调用相关内容。

type - 值为checkbox时,本条字段类型为复选框

multiple - 输入框自增,若值为true,则文件上传输入框的个数可点击增加。

其它:

subtype可以是自己定义的数组,也可以是page、category(或自定义分类法名称)、nav_menu、sidebar。