【发布时间】:2014-12-24 00:21:17
【问题描述】:
我在我的 wordpress 主题中使用 redux 框架。
我的全局变量是$ua_options
所以我在config.php 中创建了一个开关:
array(
'id' => 'ua-enable-responsive',
'type' => 'switch',
'title' => __( 'Responsive', 'redux-framework-demo' ),
'compiler' => 'true',
'mode' => false,
),
在我的functions.php 中,我想有条件地将文件排入队列:
if ($ua_options['ua-enable-responsive']) {
wp_enqueue_style( 'mytheme-bootstrap', get_template_directory_uri() . '/css/bootstrap.css' );
}
else {
wp_enqueue_style( 'mytheme-non-responsive', get_template_directory_uri() . '/css/no-responsive.css' );
}
但这似乎不起作用。无论我是否在后端打开开关,第二个文件 no-responsive.css 都会被加载。
我还在functions.php顶部调用了全局变量
global $ua_options;
有人知道为什么这不起作用吗?还有没有办法显示此类错误/警告?
【问题讨论】:
标签: php wordpress redux-framework