• Hello,

    I am working locally using Mamp and I have a parent theme loaded. I created a child theme folder and added style.css and in the functions.php file I have the following code.

    <?php
    add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
    
    function enqueue_parent_styles() {
       wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
    }

    The parent theme loads the CSS file fine, but the child theme does not load the CSS. When I inspected the code I see the following error.

    Refused to apply style from ‘https://mytestsite.com:8888/wp-content/themes/understrap-child/css/theme.min.css?ver=1.0.0.1529334299&#8217; because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled.

    any ideas what’s up and how to fix?

Viewing 1 replies (of 1 total)
  • Moderator t-p

    (@t-p)

    Have you also enqueued child theme’s css?

    add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
    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')
        );
    } 

    For info, see https://developer.www.ads-software.com/themes/advanced-topics/child-themes/

Viewing 1 replies (of 1 total)
  • The topic ‘child theme not loading css’ is closed to new replies.