Archived topic
How to deactivate default styles
5 replies · Started by mkjj on February 26, 2021
I use the GP Premium plugin mostly for the elements feature. Usually, I don't activate the other features. Sometimes, this makes things more complicated. The default settings are loaded so that I would have to use !important in the child theme to override it (the color of the navigation, for example). Can I deactivate the default settings? What would recommend?
Hi there,
if your child theme CSS is not working without the use if !important then it means either:
1. the CSS selector you're using in child theme CSS needs to be more specific.
If you have a link that i can see where you're applying the CSS with important i can advise.
2. The Child Theme has the same CSS selector specificity but is being loaded before the the Theme styles... again if i can see a link i can diagnose the problem.
Sorry, my mistake. Everything works fine. Was probably just a cache problem. However, some of the CSS DOES load after the child theme css. For example:
/gp-premium/menu-plus/functions/css/navigation-branding-flex.min.css
<style id='generate-navigation-branding-inline-css'>
While I could use more specific selectors I would prefer to have more control over it. There is no built-in feature for deactivating CSS, so that I would have to deregister the stylesheets or inline style in the functions.php? That's perfectly fine, I just would like to know what's best practice here.
I've just finished a new customer site with Generatepress. Again, page speed ist just awesome. Such a pleasure to work with this theme.
Hi there,
You can tell the child theme stylesheet to load later quite easily.
Give this a shot:
add_action( 'wp_enqueue_scripts', function() {
wp_dequeue_style( 'generate-child' );
wp_enqueue_style( 'generate-child' );
}, 500 );
Let me know :)
Hi Tom,
great idea. Works like a charm (a ' is missing in line 3).
Thank you!
Glad it worked! :)