In my wordpress child theme css file loaded before main theme css. My child theme css functions.php file is given below
function my_theme_enqueue_styles(){ wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/../enfold-child/plugins/bootstrap/css/bootstrap.min.css' ); } add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
I want to load child theme css after parent theme css.
Advertisement
Answer
Add the priority. Here 99 is high, so it will likely be last but some plugins may add css at a higher priority, though it’s rare.
function my_theme_enqueue_styles(){ wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/../enfold-child/plugins/bootstrap/css/bootstrap.min.css' ); } add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles', 99 );
See: https://developer.wordpress.org/reference/functions/add_action/