- This topic has 3 replies, 2 voices, and was last updated 5 years, 10 months ago by
Tom.
-
AuthorPosts
-
June 1, 2020 at 2:28 pm #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-csswhere 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
BenJune 1, 2020 at 4:04 pm #1310425Tom
Lead DeveloperLead DeveloperHi 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 🙂
June 2, 2020 at 2:26 am #1310845Ben
That’s perfect, many thanks Tom. I’ll be adding that as default from now on.
BWJune 2, 2020 at 9:24 am #1311493Tom
Lead DeveloperLead DeveloperGlad I could help 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.