WordPressで子テーマを作成しております。
子テーマのfunction.phpに次のように記述をすることで、実装しております。
<?php add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); } ?>
この度、親テーマにありますhoge.cssを子テーマで書き換えたいため、
次のように記述してみました。
<?php add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'hoge', get_template_directory_uri() . '/hoge.css'); } ?>
しかし、結果として、hoge.cssの内容を上書きすることはできませんでした。
記述の問題なのか、そもそもstyle.cssファイルしか上書きできないのかがわからず困っております。
尚、hoge.cssに記載しているクラス名を子テーマのstyle.css内に記載してみても上書きできませんでした。
ただし、こちらの方法は、管理がややこしくなりそうですので、できれば、子テーマで複数のcssを上書きできるようにしたいと思っております。
宜しくお願い致します。
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。
2017/05/29 09:41