我正在使用 Redux Wordpress 框架,在检索排序器中的页面数据时遇到了一些麻烦。
这是我的数组,其中“页面”被拉为数据,以及我的预设选项。
array(
'id' => 'opt-homepage-layout',
'type' => 'sorter',
'title' => 'Layout Manager ',
'subtitle' => 'Organise how you want the layout on the home page',
'compiler' => 'true',
'data' => array('disabled' => 'pages'),
'options' => array(
'enabled' => array(
'hero' => 'Hero',
'menu' => 'Menu',
/*'team' => 'Team',
'quote' => 'Quote',
'portfolio' => 'Portfolio',
'testimonial' => 'Testimonial',
'prices' => 'Prices',*/
'map' => 'Map',
'contact' => 'Contact'
),
'disabled' => array(
),
'backup' => array(
),
),
'limits' => array(
'disabled' => 10,
'backup' => 20,
),
),
这是我的前端,它很好地显示了我的预定义块,我只是无法获得显示动态页面的代码,到目前为止我已经到处搜索了所有死胡同。
$layout = $redux_option['opt-homepage-layout']['enabled'];
if ($layout): foreach ($layout as $key=>$value) {
switch($key) {
case 'hero': get_template_part( 'templates/content', 'Hero' );
include(dirname(__FILE__) . '/../includes/hero.php');
break;
case 'menu': get_template_part( 'templates/content', 'Menu' );
include(dirname(__FILE__) . '/../includes/nav.php');
break;
case 'team': get_template_part( 'templates/content', 'Team' );
include(dirname(__FILE__) . '/../includes/team.php');
break;
case 'quote': get_template_part( 'templates/content', 'Quote' );
include(dirname(__FILE__) . '/../includes/quote.php');
break;
case 'portfolio': get_template_part( 'templates/content', 'Portfolio' );
include(dirname(__FILE__) . '/../includes/portfolio.php');
break;
case 'testimonial': get_template_part( 'templates/content', 'Testimonial' );
include(dirname(__FILE__) . '/../includes/testimonial.php');
break;
case 'prices': get_template_part( 'templates/content', 'Prices' );
include(dirname(__FILE__) . '/../includes/prices.php');
break;
case 'map': get_template_part( 'templates/content', 'Map' );
print_r ('<div id="map"></div>');
break;
case 'contact': get_template_part( 'templates/content', 'Contact' );
include(dirname(__FILE__) . '/../includes/contact.php');
break;
case 'pages': get_template_part( 'templates/content', 'Pages' );
include(dirname(__FILE__) . '/../includes/contact.php');
break;
}
}
endif;
你的帮助会很棒!