【发布时间】:2015-05-16 17:50:27
【问题描述】:
我正在尝试从除结帐/购物车/收据页面之外的所有页面中取出 woocommerce 样式表。
woocommerce 帮助页面 (http://docs.woothemes.com/document/disable-the-default-stylesheet/) 中的代码用于完全删除样式表。
add_filter( 'woocommerce_enqueue_styles', '__return_empty_array' );
我尝试使用此代码,但它不起作用:
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ));
if ( function_exists( 'is_woocommerce' ) ) {
if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) {
add_filter( 'woocommerce_enqueue_styles', '__return_empty_array' );
}}
}
【问题讨论】:
-
我正在尝试使用 add_filter('woocommerce_enqueue_styles', '__return_empty_array');。但是,它对我不起作用。我将代码放在我的子主题的functions.php 中。任何想法为什么它不起作用?
标签: php wordpress woocommerce