• I am not sure what has happened to my Twentyfourteen child theme. Without having touched the site in a few days, the CSS from the child theme is no longer loading, with this error found on the server:

    Did not parse stylesheet at ‘https://www.mysite/wp-content/themes/twentyfourteenchild/style.css?b-modified=1481820305&ver=751d4e15546b157d8a65edb7e1afe76f’ because non CSS MIME types are not allowed in strict mode.

    Well, OK. I had been using the @import method in the child theme’s style.css to load the Twentyfourteen basic stylesheet. I understand, after a bit of research, that this is no longer the best way to load a child theme’s CSS. So, I went into the child theme’s functions.php and added this code:

    function theme_enqueue_styles() {

    wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’, array( ‘genericons’ ) );
    wp_enqueue_style( ‘child-style’,
    get_stylesheet_directory_uri() . ‘/style.css’,
    array( ‘parent-style’ )
    );
    }
    add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );

    That apparently doesn’t work. After trying this, examining the code in a browser tool shows that indeed the child theme’s css file is being loaded, BUT it contians an entire page’s worth of HTML code along with the custom CSS – and it doesn’t work.

    If I just paste my custom CSS code into the Theme/Customize/Additional CSS, it works fine.

    I am not sure where to begin troubleshooting this problem. All of my Themes, plugs and WP itself are up to date.

    TIA!

    • This topic was modified 8 years, 2 months ago by wpress2010.
  • The topic ‘How to enqueue CSS styles in Twentyfourteen child theme?’ is closed to new replies.