我在我的 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;
有人知道为什么这行不通吗?还有一种方法可以显示此类错误/警告吗?