- Acme Themes

Best Premium and Free WordPress Themes Forums Event Star Bootstrap CSS Loads After Parent and Child Theme CSS Reply To: Bootstrap CSS Loads After Parent and Child Theme CSS

#81824
Daniel Bye
Participant

Hi,

There’s been no reply from premium support in 2 days. In the end I sorted this problem myself through research – by making bootstrap dependent on the parent theme:

add_action( 'wp_enqueue_scripts', 'bigint_enqueue_styles' );
function bigint_enqueue_styles() {
    $parenthandle = 'event-star-style';
    $theme = wp_get_theme();
    wp_enqueue_style( $parenthandle, get_template_directory_uri() . '/style.css', 
        array('bootstrap'),
        $theme->parent()->get('Version')
    );
    wp_enqueue_style( 'child-style', get_stylesheet_uri(),
        array( $parenthandle ),
        $theme->get('Version')
    );
}

I noticed the free theme loads bootstrap CSS after the theme CSS too as soon as a child theme is added. Just one of the issues this causes is that Bootstrap creates a coloured menu item background on hover.

Anyway, the solution above works. This topic can be closed.