[Resolved] How to deactivate default styles

Home Forums Support [Resolved] How to deactivate default styles

Home Forums Support How to deactivate default styles

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1673473
    mkjj

    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?

    #1673568
    David
    Staff
    Customer Support

    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.

    #1675045
    mkjj

    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.

    #1676329
    Tom
    Lead Developer
    Lead Developer

    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 ๐Ÿ™‚

    #1676959
    mkjj

    Hi Tom,
    great idea. Works like a charm (a ‘ is missing in line 3).

    Thank you!

    #1677653
    Tom
    Lead Developer
    Lead Developer

    Glad it worked! ๐Ÿ™‚

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.