Why are my parent styles loading after my child styles?
I am trying to build a child theme that uses SCSS. However, every time I make changes and recompile my stylesheet, it gets overridden by the parent stylesheet. This is because, in the head of my site, the parent styles are loading after the child styles. I cannot for the life of me figure out how to get the child styles to load last. I've looked at similar questions here and elsewhere and I cannot get it to work. This is what I have in my parent theme in library > theme.php:
if (!function_exists('slam_scripts_and_styles')) {
function slam_scripts_and_styles() {
global $wp_styles; // call global $wp_styles variable to add conditional wrapper around ie stylesheet the WordPress way
if (!is_admin()) {
$theme_version = wp_get_theme()-Version;
// register main stylesheet
wp_enqueue_style( 'slam-stylesheet', get_template_directory_uri() . '/library/css/style.css', array(), $theme_version, 'all' );
}
}
}
And this is in my child functions.php:
//Get UIC Child Theme Styles
function uic_styles() {
wp_dequeue_style( 'slam-stylesheet', get_template_directory_uri() . '/library/css/style.css', array(), $theme_version, 'all' );
wp_enqueue_style( 'uic-styles', get_stylesheet_directory_uri() . '/library/css/style.css' );
}
add_action( 'wp_enqueue_scripts', 'uic_styles', 10 );
Any help would be much appreciated. I feel like I've been banging my head against a wall for several hours.
Topic sass wp-enqueue-style parent-theme child-theme css Wordpress
Category Web