我一直有這個問題,雖然我的解決方案是相當具體到我自己的應用程序,你會發現在它的使用。
我的問題是我想要白色的菜單文字和淺灰色的懸停顏色。默認情況下,您遇到問題的內聯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值。希望這些信息對你有所幫助。
我發現,在店面引用> INC>類storefront.php線181和店面> INC> woocommerce>類店面,woocommerce.php線76 ......如果,可以幫助你。在那2個文件的開頭有一些註冊鉤子。我會刪除我的答案,然後...希望你會快速找到解決方案 – LoicTheAztec
我認爲它的鉤子內的某種鉤子 – Stuart