wordpress-什么是';std&x27;对于';列表项';选项树类型?
我想为wordpress-什么是';std&x27;对于';列表项';选项树类型?,wordpress,Wordpress,我想为列表项类型设置一个默认值('std')。我知道如何为列表项以外的类型设置std。下面是一个例子: array( 'id' => 'logo', 'label' => 'Logo', 'std' => OT_URL.'others/logo@2x.png', // This is std for upload type. 'type' => 'upload', ), array
列表项
类型设置一个默认值('std'
)。我知道如何为列表项以外的类型设置std
。下面是一个例子:
array(
'id' => 'logo',
'label' => 'Logo',
'std' => OT_URL.'others/logo@2x.png', // This is std for upload type.
'type' => 'upload',
),
array(
'id' => 'regions-page',
'label' => 'Default Page Widgets Area',
'std' => 'right', // This is std for radio-image type.
'type' => 'radio',
'choices' => array(
array(
'value' => 'right',
'label' => 'Region 2',
),
array(
'value' => 'left',
'label' => 'Region 3',
),
)
对于radio
和select
等类型,有一些选项
,其中std
可能指的是它们的值之一<代码>列表项
类型具有类似于选项
的内容,称为设置
。下面是列表项类型的示例:
array(
'id' => 'home-ads-items',
'label' => 'Add ADS. banner under Featured Products',
'std' => '', // I want to set this in order to Image setting would be its default.
'type' => 'list-item',
'settings' => array(
array(
'id' => 'img',
'label' => 'Image',
'std' => '',
'type' => 'upload',
'class' => '',
'choices' => array()
),
...
我想设置std
,以便将Image
设置为默认值。但我不知道怎么做。事实证明这相当简单。我假设你有最新的版本(2.2.0),我不知道它是否在较低的版本中工作
所以,考虑这个配置:
'id' => 'colors',
'section' => 'colors',
'label' => 'Colors',
'type' => 'list-item',
'settings' => array(
array(
'id' => 'color',
'label' => 'Color',
'type' => 'colorpicker',
),
),
现在,我们想要两种默认颜色,白色和黑色。只需在std
选项中添加两个数组,并使用id
作为键。因此,我们补充说:
'std' => array(
array('title' => 'White', 'color' => '#ffffff'),
array('title' => 'Black', 'color' => '#000000'),
),
就这样。您将有两种预定义的颜色。如您所见,我们没有配置id为的列表项,但它仍然存在,因为这是每个选项可用的默认条目。事实证明它非常简单。我假设你有最新的版本(2.2.0),我不知道它是否在较低的版本中工作
所以,考虑这个配置:
'id' => 'colors',
'section' => 'colors',
'label' => 'Colors',
'type' => 'list-item',
'settings' => array(
array(
'id' => 'color',
'label' => 'Color',
'type' => 'colorpicker',
),
),
现在,我们想要两种默认颜色,白色和黑色。只需在std
选项中添加两个数组,并使用id
作为键。因此,我们补充说:
'std' => array(
array('title' => 'White', 'color' => '#ffffff'),
array('title' => 'Black', 'color' => '#000000'),
),
就这样。您将有两种预定义的颜色。如您所见,我们没有配置id为的列表项,但它仍然存在,因为这是每个选项可用的默认项。只需设置为'std'=>数组('id'=>'xx','label'=>'dfd');不,没用。什么也没发生。您是在“设置”中还是在一级数组中谈论STD?只需设置为“STD”=>array('id'=>'xx','label'=>'dfd');不,没用。什么也没发生。你是在“设置”中还是在一级数组中谈论STD?