• Hi

    I have built a child theme for Storefront but something bizarre is happening. The css applied through the child theme is not being applied. If I use the customiser it works.

    Any idea why please?

    Thanks

    Rich

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Richard Brown

    (@cregy)

    I have read the problem re enqueue and this is my code:

    function storefront_parent_theme_enqueue_styles() {
        wp_enqueue_style( 'storefront-style', get_template_directory_uri() . '/style.css' );
        wp_enqueue_style( 'storefront-child-style',
            get_stylesheet_directory_uri() . '/style.css',
            array( 'storefront-style' )
        );
        if ( is_product_category() || is_shop() ) {
        	wp_enqueue_style( 'custom-product-category',
    	        get_stylesheet_directory_uri() . '/archive.css',
    	        array( 'storefront-child-style' )
    	    );
        }
    }

    Hope that helps.

    Rich

    Hello Cregy,

    To create child theme please use the below url-

    https://www.wpbeginner.com/wp-themes/how-to-create-a-wordpress-child-theme-video/

    I hope the above was helpful.

    Kind regards,

    Manoj

    Thread Starter Richard Brown

    (@cregy)

    Thanks for letting me know. The problem is not about creating the theme, I have done that many times, it seems to be a problem with enqueue rules.

    Rich

    Job a11n

    (@jobthomas)

    Automattic Happiness Engineer

    I’m sorry if this is very basic, but did you also use add_action?

    function theme_enqueue_styles() {
    
        $parent_style = 'parent-style';
    
        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 )
        );
    }
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Child theme css not being applied’ is closed to new replies.