Best Premium and Free WordPress Themes › Forums › Event Star › Bootstrap CSS Loads After Parent and Child Theme CSS
- This topic has 2 replies, 2 voices, and was last updated 3 years, 11 months ago by acmethemes.
-
AuthorPosts
-
June 17, 2020 at 1:24 pm #81701Daniel ByeParticipant
Hi,
Like title says, bootstrap CSS is loading after the parent and child theme CSS files.
I’m using the recommended function from WordPress.org to load the child theme:
add_action( 'wp_enqueue_scripts', 'event_star_child_enqueue_styles' ); function event_star_child_enqueue_styles() { $parent_style = 'event-star-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 ), wp_get_theme()->get('Version') ); }
Do you have a solution please which adds bootstrap style, then the parent style, then finally the child theme style?
Many thanks.
June 19, 2020 at 8:05 am #81824Daniel ByeParticipantHi,
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.
June 21, 2020 at 5:48 pm #81953acmethemesKeymasterDear Daniel,
That’s good to know the problem has been solved.
Best Regards! -
AuthorPosts
- You must be logged in to reply to this topic.