this is my solution to the situation where you want to enqueue a CSS file like bootstrap.css before the theme/child CSS files:
<?php
// Ref: https://developer.ww.wp.xz.cn/themes/advanced-topics/child-themes/
function my_blog_guten_scripts() {
wp_enqueue_style( 'bootstrap-4', get_template_directory_uri() . '/assets/css/bootstrap.css', array(), 'v4.3.1', 'all' );
wp_enqueue_style( 'blog-guten-fonts', '//fonts.googleapis.com/css?family=Barlow:400,400i,600,600i&display=swap' );
wp_enqueue_style( 'slicknavcss', get_template_directory_uri() . '/assets/css/slicknav.css', array(), 'v1.0.10', 'all' );
wp_enqueue_style( 'blog-guten-style', get_template_directory_uri() . '/style.css', array(), 'v1.0.8', 'all' );
wp_enqueue_style( 'blog-guten-child-style', get_stylesheet_directory_uri() . '/style.css', array('blog-guten-style'), 'v1.0.0', 'all' );
wp_enqueue_script( 'slicknav', get_template_directory_uri() . '/assets/js/jquery.slicknav.js', array('jquery'), 'v1.0.10', true );
wp_enqueue_script( 'blog-guten-skip-link-focus-fix', get_template_directory_uri() . '/assets/js/skip-link-focus-fix.js', array(), '20151215', true );
wp_enqueue_script( 'blog-guten-navigation', get_template_directory_uri() . '/assets/js/navigation.js', array(), '20151215', true );
wp_enqueue_script( 'blog-guten-theme', get_template_directory_uri() . '/assets/js/theme.js', array('jquery'), '1.0.0', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'my_blog_guten_scripts' );
the child theme’s functions.php loads first, and the second enqueue of a file does not seem to take place, I was really wondering if enqueueing a file like bootstrap-4 in both the child theme and the theme would work, but it seems to be working OK. this code does load the CSS files in the order you want them to load and seems to get around the problem I was having with the original child theme functions.php file.
Al