Support » Fixing WordPress » Fresh TwentySeventeen completely ignores child theme css

  • I have an issue with Twenty Seventeen child theme.

    I have created both style.css and functions.php files. I have successfully loaded the -child theme and my website is currently running it. However, whatever changes I make in the child style.css, they are completely ignored.

    I want my child style.css to overwrite any default twentyseventeen style.css rules.
    The problem is, no matter what I write in my child style.css file, it is completely ignored and all the styles are loaded from parent style.css

    Any help would be appreciated.

    style.css code:

    /*
     Theme Name:   Twenty Seventeen Child
     Theme URI:    http://www.example.com
     Description:  Twenty Seventeen Child theme
     Author:       Author
     Author URI:   http://www.example.com
     Template:     twentyseventeen
     Version:      1.0.0
     License:      GNU General Public License v2 or later
     License URI:  http://www.gnu.org/licenses/gpl-2.0.html
     Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
     Text Domain:  twenty-seventeen-child
    */

    functions.php code

    <?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' );
    ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Forum Moderator & Support Team Volunteer

    Please provide a link to your site. Thanks.

    also, please provide examples of CSS in the child theme which you have tried to use to overwrite the parent CSS …

    YYH MSG

    (@supportyyhmsgnet)

    In your functions php code your cut and paste version is for twentyfifteen

    this line:
    $parent_style = ‘parent-style’;

    needs to contain the twentyseventeen style sheet
    $parent_style = ‘twentyseventeen-style’;

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Fresh TwentySeventeen completely ignores child theme css’ is closed to new replies.