是否可以在选项中获取文本而不是id("键")?例如。
$fields = array(
'id' => 'opt-select',
'type' => 'select',
'title' => __('Select Option', 'redux-framework-demo'),
'subtitle' => __('No validation can be done on this field type', 'redux-framework-demo'),
'desc' => __('This is the description field, again good for additional info.', 'redux-framework-demo'),
// Must provide key => value pairs for select options
'options' => array(
'1' => 'Opt 1',
'2' => 'Opt 2',
'3' => 'Opt 3'
),
'default' => '2',
);
而不是得到
global $redux_demo;
echo 'Single Select value: ' . $redux_demo['opt-select'];
这将返回 1、2、3。但是我想得到选项 1、选项 2、选项 3。这可能吗?
不是真的。您正在声明一个键值集。键只是指向值的指针。如果您希望指针和键相同,请使用 then 提供一个非多维数组来表示键和值是相同的。