Stylesheet ordering in child theme
-
I have a theme that loads bootsstrap.css, then the themes .css. When I try to mke a child theme, the style sheets load in the wrong order. It loads parent theme, then bootstrap, then the child theme.
Here is what I’m using in the parent theme
function doublewide_scripts() { wp_enqueue_style( 'bootstrap-styles', get_template_directory_uri() . '/css/bootstrap.min.css', array(), '3.2.0', 'all' ); wp_enqueue_style( 'doublewide-style', get_stylesheet_uri() ); wp_enqueue_script( 'main-js', get_template_directory_uri() . '/js/main.js', array('jquery'), '1.0.0', true ); wp_enqueue_script( 'bootstrap-js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '3.2.0', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'doublewide_scripts' );
and this is what I’m using in the child theme
function wpchildthemes12122_enqueue_parent_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' ); } add_action( 'wp_enqueue_scripts', 'wpchildthemes12122_enqueue_parent_styles' );
I could probably dequeue everything in the child theme and reload it in the right order but shouldn’t the stylesheets load in the same order as the parent theme besides the child style loading at the end?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Stylesheet ordering in child theme’ is closed to new replies.