WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Base Knowledge Theme Base Child CSS (2 posts)

  1. double_dd
    Member
    Posted 1 year ago #

    Hi,

    There is a child theme already bundled with this theme but it doesn't seem to be allowing the style.css in the child to override the parent style.css.

    I have 2 theories:

    1) The link to the stylesheet isn't working properly in the head - not sure if it's meant to pull the child theme but it doesn't. the code is:
    wp_enqueue_style( 'main-style', get_template_directory_uri(). '/style.css', false, '1.4', 'all');

    which then generates:

    <link rel='stylesheet' id='main-style-css' href='http://www.my domain.com/wp-content/themes/base/style.css?ver=1.4' type='text/css' media='all' />

    2) You can hard code the style in the head and this does over ride styles. Now this is loaded after so should work as it does.

    Is there something theme specific making this hard work? I've got child themes working on other sites and there is no difference between the child stylesheets I have.

    All other files in the child theme work as expected e.g. header.php etc

  2. double_dd
    Member
    Posted 1 year ago #

    Now resolved:

    Instead of this:

    wp_enqueue_style( 'main-style', get_template_directory_uri(). '/style.css', false, '1.4', 'all');

    use this:

    wp_enqueue_style( 'main-style', get_stylesheet_directory_uri(). '/style.css', false, '1.4', 'all');

    This then picks up the child theme instead of using the parent theme in the link to the stylesheet.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags