• I installed your “Course” theme and created my child theme to overwrite certain styles.
    However, I encountered a problem because in “Course” theme you incorrectly set the path to the style.css file:

    functions.php, line 43:

    wp_register_style( 'course-style', get_stylesheet_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) );

    The get_stylesheet_directory_uri() function returns the path to my child theme:

    wp-content/themes/my-child-theme/style.css?ver=1.0

    You should use the get_template_directory_uri() funcion to get path to parent theme:

    wp-content/themes/course/style.css?ver=1.0
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello,

    I’ve just tried creating a child theme named Course Test and my changes were applied without issue. Here are the contents of my child theme’s style.css file:

    /*
    Theme Name: Course Test
    Template: course
    */

    body {
    color: yellow;
    background: black;
    }

    get_stylesheet_directory_uri() returns http://mysite.com/wp-content/themes/course-test/style.css, which is the correct CSS file.

    So I’m not seeing an issue with the code in its current form.

    Thread Starter pepe80

    (@pepe80)

    A child template should overwrite the parent template, not replace it. In my opinion wordpress should load styles like this:

    http://mysite.com/wp-content/themes/course/style.css
    http://mysite.com/wp-content/themes/course-test/style.css
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.