2016-05-16 66 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值。希望這些信息對你有所幫助。