Best way to override plugin css

This topic contains 6 replies, has 3 voices, and was last updated by  purpleedge 9 years, 10 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #6933

    purpleedge
    Expired Member
    Post count: 539

    I’m trying to style the search box which is styled in

    /plugins/geodirectory/geodirectory-assets/css/style.css?ver=1.1.5

    .geodir-loc-bar {
    margin: 0 !important;
    padding: 10px !important;
    border: medium none !important;
    }

    I don’t really want to put !important everywhere – is there a better way?

    Can I use wp_enqueue_style somehow?

    #6934

    Guust
    Moderator
    Post count: 29970

    You should not have to use !important if you add it to your child theme.
    Wp admin > editor > child theme > style.css

    Where are you adding your css?

    #6935

    purpleedge
    Expired Member
    Post count: 539

    Hi Guust, I’m editing the child theme style.css

    #6938

    Guust
    Moderator
    Post count: 29970

    Can you give me a link, I am surprised that you need to add !important.

    #6941

    purpleedge
    Expired Member
    Post count: 539

    Hi Guust, still on local host, I’ll try and upload to a dev site tomorrow.

    #7066

    John Allsopp
    Expired Member
    Post count: 399

    If you are having to use !important, you are not being specific enough. To add specificity easily, try adding a body class and use that in your declarations.

    The other way to do it would be to dequeue the plugin’s stylesheet and then enqueue it again earlier, or dequeue your child theme’s stylesheet and enqueue it again to be later than the plugin stylesheet.

    I wrote a post on this a while back – https://wpgeodirectory.com/support/topic/override-wpgeo-styles/

    #7081

    purpleedge
    Expired Member
    Post count: 539

    Thanks John, that is exactly what I was looking for. In this case more specificity is probably the better solution to avoid messing up styles elsewhere.

Viewing 7 posts - 1 through 7 (of 7 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket