[Resolved] Child style.css loading order

Home Forums Support Child style.css loading order

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1310353
    Ben

    I’m having trouble with loading order of child style sheet.

    It appears that themes/child/style.css is being loaded BEFORE
    /plugins/gp-premium/blog/functions/css/style-min.css
    plugins/gp-premium/menu-plus/functions/css/offside.min.css
    generate-offside-inline-css

    where these have values that I need to tweak in child style sheet.

    Order of loading in source is below

    <link rel=’stylesheet’ id=’wp-block-library-css’ href=’…/wp-includes/css/dist/block-library/style.min.css’ type=’text/css’ media=’all’ />

    <link rel=’stylesheet’ id=’generateblocks-css’ href=’…/wp-content/uploads/generateblocks/style-2.css’ type=’text/css’ media=’all’ />

    <link rel=’stylesheet’ id=’generate-style-css’ href=’…/wp-content/themes/generatepress/css/all.min.css’ type=’text/css’ media=’all’ />

    <style id=’generate-style-inline-css’ type=’text/css’>.single .entry-header{display:…

    <link rel=’stylesheet’ id=’generate-child-css’ href=’…/wp-content/themes/child/style.css’ type=’text/css’ media=’all’ />

    <link rel=’stylesheet’ id=’generate-blog-css’ href=’…/wp-content/plugins/gp-premium/blog/functions/css/style-min.css’ type=’text/css’ media=’all’ />

    <link rel=’stylesheet’ id=’generate-offside-css’ href=’…/wp-content/plugins/gp-premium/menu-plus/functions/css/offside.min.css’ type=’text/css’ media=’all’ />

    <style id=’generate-offside-inline-css’ type=’text/css’>.slideout-navigation.main-navigation{background ….

    <style type=”text/css” id=”simple-css-output”>body{padding:…

    Now I can get around this potentially by caching all of the style sheets EXCEPT for the child style, but this still leaves the “generate-offside-inline-css” loading after my child style.css.

    Is there a way to ensure that the child style has the highest priority (eg loads last)?

    Many thanks for any help you can give
    Ben

    #1310425
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Give this a shot:

    add_action( 'wp_enqueue_scripts', function() {
        wp_dequeue_style( 'generate-child' );
        wp_enqueue_style( 'generate-child' );
    }, 999 );

    Let me know 🙂

    #1310845
    Ben

    That’s perfect, many thanks Tom. I’ll be adding that as default from now on.
    BW

    #1311493
    Tom
    Lead Developer
    Lead Developer
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.