我只是想测试foreach / switch的输出,但是没有回音的日期
Redux::setSection( $opt_name, array(
'title' => __( 'Sorter', 'redux-framework-demo' ),
'id' => 'additional-sorter',
'subsection' => false,
'fields' => array(
array(
'id' => 'opt-homepage-layout',
'type' => 'sorter',
'title' => 'Layout Manager Advanced',
'subtitle' => 'You can add multiple drop areas or columns.',
'compiler' => 'true',
'options' => array(
'enabled' => array(
'highlights' => 'Highlights',
'slider' => 'Slider',
'staticpage' => 'Static Page',
'services' => 'Services'
),
'disabled' => array(),
'backup' => array(),
),
'limits' => array(
'disabled' => 1,
'backup' => 2,
),
),
array(
'id' => 'opt-homepage-layout-2',
'type' => 'sorter',
'title' => 'Homepage Layout Manager',
'desc' => 'Organize how you want the layout to appear on the homepage',
'compiler' => 'true',
'options' => array(
'enabled' => array(
'highlights' => 'Highlights',
'slider' => 'Slider',
'staticpage' => 'Static Page',
'services' => 'Services'
),
'disabled' => array(
),
),
),
)
));
我只是想测试foreach / switch的输出,但是没有回音的日期
global $redux_data;
echo 'Enabled column' . '<br />';
print_r ($redux_data['opt-homepage-layout-2']['enabled']);
echo '<br /><br />Disabled column' . '<br />';
print_r ($redux_data['opt-homepage-layout-2']['disabled']);
global $redux_options;
$layout = $redux_options['opt-homepage-layout-2']['enabled'];
if ($layout): foreach ($layout as $key=>$value) {
switch($key) {
case 'slider': echo "slider";
break;
case 'highlights': echo "highlights";
break;
case 'services': echo "services";
break;
case 'staticpage': echo "services";
break;
}
}
endif;
答案 0 :(得分:0)
global $redux_options;
$layout = $redux_options['opt-homepage-layout-2']['enabled'];
更改为:
global $redux_data; // My var name $opt_name
$layout = $redux_date['opt-homepage-layout-2']['enabled']; // My var name $opt_name