2017-02-07 2 views
0

私のテーマは正しく親からスタイルを継承しますが、私のカスタムCSSは効果がありません。親からスタイルを継承していますが、私のカスタムCSSは効果がありません

私はtwentyten-childという名前のwp-content/themesフォルダに新しいフォルダを作成しました。あなただけ、あなたも親CSSの依存関係が含まれている

/* 
Theme Name: Twentyten Child 
Theme URI: https://p4002720.scm.tees.ac.uk/thetreasurechestWP/ 
Description: This is a aged, weathered, worn and nostalgic style theme 
Author: Michael Barley 
Author URI: https://www.facebook.com/profile.php?id=100008253000376 
Template: twentyten 
Version: 0.1 
License: GNU General Public License v2 or later 
License URI: http://www.gnu.org/licenses/gpl-2.0.html 
*/ 
body { 
    background: green; 
} 
+0

子供のテーマをアクティブにしましたか? – Blackbam

+0

ええ、 'Twentyten Child'が活動しています@Blackbam –

+0

コーデックスのすべての指示に従っていますか:https://codex.wordpress.org/Child_Themes? – Blackbam

答えて

0

を:

<?php 
/** 
* Loads the parent stylesheet. 
*/ 
function load_parent_stylesheet() { 
    wp_enqueue_style('parent-styles', get_template_directory_uri() . '/style.css'); 
} 
add_action('wp_enqueue_scripts', 'load_parent_stylesheet'); 
?> 

は私も含まれているという名前のstyle.css内のファイルを作成:

私は含まれていfunctions.phpというファイルを作成しましたCodexで説明されているように、子テーマCSSを含める必要があります。https://codex.wordpress.org/Child_Themes

<?php 
function my_theme_enqueue_styles() { 

    $parent_style = 'parent-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme. 

    wp_enqueue_style($parent_style, get_template_directory_uri() . '/style.css'); 
    wp_enqueue_style('child-style', 
     get_stylesheet_directory_uri() . '/style.css', 
     array($parent_style), 
     wp_get_theme()->get('Version') 
    ); 
} 
add_action('wp_enqueue_scripts', 'my_theme_enqueue_styles'); 
?> 
関連する問題