いくつかの試行錯誤の末、私はtwentysixteenの以前のように22歳の子供のテーマを作成したように見えますが、ダッシュボードに私のテーマに選んだ名前が表示されますが、ロードされたスタイルシートは私子テーマのstyle.cssを修正し、元のtwentyseventeen.cssをロードしています。レンダリングされたページには<link rel='stylesheet' id='twentyseventeen-style-css' href='https://cjshayward.com/wp-content/themes/twentyseventeen/style.css?ver=4.7' type='text/css' media='all' />
が含まれます。チャイルドテーマのWP 22でスタイルシートを指定するにはどうすればよいですか?私が選んだ子供のテーマを登録するには何が必要ですか?
親テーマのスタイルシートの代わりに独自のテーマを使用するように子テーマを変更するにはどうすればよいですか?
私のfunctions.phpは読む:
<?php
update_option('siteurl', 'https://cjshayward.com');
update_option('home', 'https://cjshayward.com');
add_action('wp_enqueue_scripts', 'theme_enqueue_styles');
function theme_enqueue_styles() {
wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css');
}
?>
はこれまでのところ、私が試したすべてのものは、独自のスタイルシート、
/wp-content/themes/twentyseventeen-ux-tweaks-child/style.css
からロードするようにそれを得るために失敗しました。編集
functions.php
は機能しませんでした。
header.php
の編集はうまくいきませんでしたが、二次的なダメージがあるかどうかは疑問に思っていますが、22世紀のオリジナルではなく私の子供のテーマを使用するように正式に言わなかったからです。
get_template_directory_uri()
を
'/wp-content/themes/twentyseventeen-ux-tweaks-child
に置き換えると機能しませんでした。私はおそらく、私はApacheのURLの書き換えをしたいものを得ることができますが、私は実際に
を知りたいです Wordpressでこれを行う方法。
子テーマを正しく登録して、提供された子テーマのstyle.cssをそのスタイルシートとして使用するには、何が必要ですか?
おかげで、
--UPDATE--
は私のfunctions.phpは今読み:
<?php
update_option('siteurl', 'https://cjshayward.com');
update_option('home', 'https://cjshayward.com');
function my_theme_enqueue_styles() {
$parent_style = 'twentyseventeen';
wp_enqueue_style($parent_style, get_template_directory_uri() .
'/style.css');
wp_enqueue_style('twentyseventeen-ux-tweaks-child',
get_stylesheet_directory_uri() . '/style.css',
array($parent_style)
);
}
add_action('wp_enqueue_scripts', 'my_theme_enqueue_styles');
?>
私は以前と同じ振る舞いを経験しています。 https://cjshayward.com/wp-content/theme/twentyseventeen-ux-tweaks-child/style.css
が要素の検査とスタイルシートのトレースをまだ見ていません。
あなたは子供を含む、子テーマのスタイルシートのヘッダーにコメントを挿入していますテーマとテンプレート名? – Johannes