2016-05-16 18 views
4

Wordpress WooCommerce StoreFrontテーマは、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> 

私は自分が望むものを定義するよりも、これらのスタイルを過度に正しいものにする時間が増えているようです。誰もそれらを削除するか、Storefrontカスタマイザを無効にする方法を知っていますか?

Header Styles

+0

私は、storefront> inc> class-storefront.php 181行目とstorefront> inc> woocommerce> class-storefront-woocommerce.php 76行目の参照が見つかりました。その2つのファイルの始めにいくつかの登録フックがあります。私は私の答えを削除します...あなたはすぐに解決策を見つけることを望みます – LoicTheAztec

+0

私はフックの中でフックのいくつかの種類と思う – Stuart

答えて

2

インラインCSSのうちの2つは、クラスストアフロント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

これと戦っている人にとって、これは私が見つけた解決策である:

add_filter('storefront_customizer_enabled', 'woa_storefront_disable_customizer'); 

function woa_storefront_disable_customizer() { 
    return false; 
} 

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

役に立ったが、OPが望んでいた_これにより、Storefrontによって**エンキューされた**スタイルが削除され、 ' '内に追加されるインラインスタイルは削除されません。 –

0

私はこの問題を持っていたに以下のコードを入れて、私の解決策は、私自身のアプリケーションに非常に特有のですが、あなたはそれで用途を見出すことができます。

私の問題は、白いメニューテキストを明るいグレーのホバーカラーで表示したかったということでした。デフォルトでは、あなたが問題を抱えているインラインCSSは、あなたのメニューテキストの色を取り、要因でそれを明るくし、その色をホバーカラーとして設定しました。明らかに白は明るくすることができないので、私のメニューはホバリングで同じままだった。ここで私はこれを解決した方法です:

"class-storefront-customizer"というファイルにあります。WP-コンテンツ/テーマにあるPHP」/ 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を設定私が欲しいのは、私の場合#aeaeaeで、これはデフォルト値の色をエディタの値に設定したものですが、このステップは必要ではありませんが、もっと簡単になります。

私はこのオプションを、本当に効果があるのは確かです...

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

このファイルの501行目は、取り除こうとしているインラインCSSを設定する関数get_css()の定義です。ホバー上のオフセット私のセットの色を変更しなかった

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

この:私はこの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に出力される値をどのように操作できるかを説明するためにすべてを示します。うまくいけば、その情報はあなたを助けてくれました。

関連する問題