起きている問題
ワードプレスでスワローというテーマを購入し、子テーマでCSSを編集したのですが、
親テーマのCSSが後から上書きされてしまい困っています。
function.phpに問題があるのかと色々調べてみたのですが、
php言語のスキルが足らず、原因がわかりません。
わかるかたご教示ください。。。
ソースコード
子テーマfunctionn.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' ); wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css?'. date("ymdHis", filemtime( get_stylesheet_directory() . '/style.css')), array('parent-style') ); } -------------------------------------------------------------------------------------- 子テーマstyle.css----------------------------------------------------------------- @charset "utf-8"; /* Template: yswallow Theme Name:yswallow_custom Theme URI: https://open-cage.com/swallow/ Description:swallowの子テーマです Version: 1.1.2 */ -------------------------------------------------------------------------------------- 親テーマstyle.css----------------------------------------------------------------- @charset "utf-8"; /****************************************************************** Theme Name: swallow Theme URI: https://open-cage.com/swallow/ Description: シンプルに。スマートに。余計な機能やデザインを取り除いたデザインテーマです。 Version: 1.1.2 Author: opencage Author URI: https://open-cage.com/ License: GNU General Public License License URI: licence.txt ******************************************************************/ --------------------------------------------------------------------------------------
編集したCSS
親テーマstyle.css----------------------------------------------------------------- .entry-content h3{ border-top: 4px solid; border-bottom: 4px solid; padding: .6em .2em; margin-top: 1.8em; color: inherit; } -------------------------------------------------------------------------------------- 子テーマstyle.css----------------------------------------------------------------- .entry-content h3{ border-top:0; ← **反映されない** border-bottom:0; ← **反映されない** border-left: 3px solid black; ← **反映される** } --------------------------------------------------------------------------------------
試したこと
キャッシュ対策のため、スワローのホームページからダウンロードした子テーマのfunction.phpを
別サイトのphpを参照し変更しました。(上記)
スワローHP:https://open-cage.com/purchase-flow/child-theme-download/
参照:リンク
元子テーマのphpとCss
元子テーマのfunction.php----------------------------------------------------------------- <?php // include child theme css add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'style', get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array('style') ); } -------------------------------------------------------------------------------------- 元子テーマのstyle.css----------------------------------------------------------------- <?php @charset "utf-8"; /* Template: yswallow Theme Name: swallow_custom Theme URI:https://open-cage.com/swallow/ */ --------------------------------------------------------------------------------------
ほぼ初心者なので、ご教示いただく上でこれ以外に必要な情報があればおしえてください。
よろしくお願いします!
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。