2016-05-16 67 views
4

Wordpress WooCommerce StoreFront Theme将来自WooCommerce StoreFront Customiser的标题中的样式排队;删除Wordpress WooCommerce StoreFront标题样式

<style id='storefront-woocommerce-style-inline-css' type='text/css'></style> 
<style id='storefront-style-inline-css' type='text/css'></style> 

我似乎花更多的时间在扶正这些样式,不是定义我想要的。有谁知道如何删除它们或禁用店面定制商?

Header Styles

+0

我发现,在店面引用> INC>类storefront.php线181和店面> INC> woocommerce>类店面,woocommerce.php线76 ......如果,可以帮助你。在那2个文件的开头有一些注册钩子。我会删除我的答案,然后...希望你会快速找到解决方案 – LoicTheAztec

+0

我认为它的钩子内的某种钩子 – Stuart

回答

2

内嵌CSS的两个类店面,customizer.php加入。

对于注销的店面风格,直列CSS:

add_filter('storefront_customizer_css', '__return_false'); 

对于注销的店面,woocommerce的风格,直列CSS:

add_filter('storefront_customizer_woocommerce_css', '__return_false'); 
+0

仍然无法正常工作。我花了数小时试图找出这一个。 – Stuart

0

是在店面2.0.4这方面的工作?

,因为我有这些过滤器:

add_filter('storefront_customizer_enabled', '__return_false'); 
add_filter('storefront_customizer_css', '__return_false'); 
add_filter('storefront_customizer_woocommerce_css', '__return_false'); 

,但我还是内联CSS。

第一个过滤器是在话题中提到: https://wordpress.org/support/topic/remove-inline-css-1?replies=8

9

对于任何与此战斗,这是我找到了解决办法:

function my_theme_remove_storefront_standard_functionality() { 

//remove customizer inline styles from parent theme as I don't need it. 
set_theme_mod('storefront_styles', ''); 
set_theme_mod('storefront_woocommerce_styles', ''); 

} 

add_action('init', 'my_theme_remove_storefront_standard_functionality'); 
+0

谢谢你!我用这个战斗太久 – Tim

+0

这应该是店面主题接受的答案 –

-1

a经过几次试验,我得到了解决问题的最终解决方案! 很简单相信:-) 删除在“类店面,customizer.php”下面一行,它的工作原理:

add_action('wp_enqueue_scripts',array($this, 'add_customizer_css'), 130); 

问候 赫伯特

+0

删除线将刹车上第一店面更新主题 –

4

我不得不最近删除这些,最好的办法是使用Ngoc Nguyen's method

只要把下面的代码到functions.php

function wpcustom_deregister_scripts_and_styles(){ 
    wp_deregister_style('storefront-woocommerce-style'); 
    wp_deregister_style('storefront-style'); 
} 
add_action('wp_print_styles', 'wpcustom_deregister_scripts_and_styles', 100); 
+0

帮助,但没有回答_exactly_什么OP想要的。这将删除店面排列的样式**,而不是它在“”内添加的内联样式。 –

0

我一直有这个问题,虽然我的解决方案是相当具体到我自己的应用程序,你会发现在它的使用。

我的问题是我想要白色的菜单文字和浅灰色的悬停颜色。默认情况下,您遇到问题的内联css似乎会使菜单文本颜色变亮,将其减少一个因子,并将该颜色设置为悬停颜色。显然,白色不能点亮,所以我的菜单在悬停时保持不变。下面是我如何解决这个问题:

在文件“class-storefront-customizer。.PHP”位于的wp-content /主题/ storefront_child/INC /定制上有主题编辑器界面是如何工作的定义函数首先,我采取了以下功能:

public static function get_storefront_default_setting_values() { 
     return apply_filters('storefront_setting_default_values', $args = array(
      'storefront_heading_color'    => '#333333', 
      'storefront_text_color'     => '#6d6d6d', 
      'storefront_accent_color'    => '#aeaeae', 
      'storefront_header_background_color'  => '#ffffff', 
      'storefront_header_text_color'   => '#6d6d6d', 
      'storefront_header_link_color'   => '#333333', 
      'storefront_footer_background_color'  => '#f0f0f0', 
      'storefront_footer_heading_color'  => '#333333', 
      'storefront_footer_text_color'   => '#6d6d6d', 
      'storefront_footer_link_color'   => '#333333', 
      'storefront_button_background_color'  => '#eeeeee', 
      'storefront_button_text_color'   => '#333333', 
      'storefront_button_alt_background_color' => '#333333', 
      'storefront_button_alt_text_color'  => '#ffffff', 
      'storefront_layout'      => 'right', 
      'background_color'      => 'ffffff', 
     )); 
    } 

我设置storefront_accent_color VAR作为偏移颜色我想要的,在我的情况下#eaeae。这将默认颜色设置为该值的编辑器。这一步是没有必要,但更容易。

我也设置此选项为相同的值,因为我不是肯定这将真正生效...

$wp_customize->add_setting('storefront_accent_color', array(
      'default'    => apply_filters('storefront_default_accent_color', '#aeaeae'), 
      'sanitize_callback'  => 'sanitize_hex_color', 
     )); 

在这个文件的第501行是函数get_css()的定义,它设置了内联css,你看到你正试图摆脱。对于我来说,我需要改变的值在本节:

.main-navigation ul li a:hover, 
     .main-navigation ul li:hover > a, 
     .site-title a:hover, 
     a.cart-contents:hover, 
     .site-header-cart .widget_shopping_cart a:hover, 
     .site-header-cart:hover > li > a, 
     .site-header ul.menu li.current-menu-item > a { 
      color: ' . storefront_adjust_color_brightness($storefront_theme_mods['header_link_color'], 80) . '; 
     } 

我改变了这个CSS属性的值设置为:

color: ' . $storefront_theme_mods['accent_color'] . '; 

这并没有改变悬停抵消我的设定颜色。它做的事情是改变编辑器。

所以最后一步是进入编辑器,进入版式选项卡,选择强调色,撞默认的颜色按钮(现在应该拿出我的颜色),然后保存。之后,我的菜单正常工作。

这是一个有点长,你问的不太什么,但我把它全部中说明如何操作是输出成内联CSS值。希望这些信息对你有所帮助。