enqueue child theme CSS last
-
Hello. My goal is to understand how to enqueue a child them style sheet so that it loads last, after all other style sheets are loaded. Including plugin etc style sheets that I may install in the future. I don’t mind, in fact I think I prefer if the parent theme is loaded before bootstrap and other styles, but I really want my child theme style sheet to load last.
So, I tried using what my research said was the proper way in my child theme functions file:
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_parent'); function my_theme_enqueue_parent() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); }
Now what I see from viewing the source code is that this not only enqueues the parent style but also the child style.
So this is the beginning of my confusion; because I don’t see any reference to the child theme in the added code.
So my first question is, does this wp_engueue_style, with parent-style as an arguement, automatically also enqueue the child theme style sheet?
Is this part of the core functionality?
Or is it possible that the theme (Start) itself is doing this? Start is a simple “starter theme”. The functions.php is only 131 lines long and I don’t see anything in there about also enqueing the child cssI have searched a lot on the forums and while this topic is very popular, I can’t find anything that addresses this particular question.
- The topic ‘enqueue child theme CSS last’ is closed to new replies.