• Hello,

    I would like to ask you for a help.
    I have child theme (of Genesis), I have tried a lot of functions, but nothing works as I expected.

    1) Child CSS is loaded two times:

    add_action( 'wp_enqueue_scripts', 'my_enqueue_styles' );
    
    function my_enqueue_styles() {
    
        /* If using a child theme, auto-load the parent theme style. */
        if ( is_child_theme() ) {
            wp_enqueue_style( 'parent-style', trailingslashit( get_template_directory_uri() ) . 'style.css' );
        }
    
        /* Always load active theme's style.css. */
        wp_enqueue_style( 'style', get_stylesheet_uri() );
    }

    2) Child CSS is loaded one times, but I have to use !important everywhere

    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
    wp_enqueue_style( 'twentyfifteen-css', get_template_directory_uri() . '/style.css' );
    }

    Is there an code, to load original css and override it by main css, without necessity to use !important or to have it loaded two times?

    Thanks you ver ymuch

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘CSS loaded two times in child theme….’ is closed to new replies.