Overriding third-party styles

I’m developing a theme with a social component for which I’m using BuddyPress and bbPress. In order to give the forums the look and feel of the rest of the site, I’m writing custom css to override the plugin’s styles. The problem I’m having is that my main.css is being included before the plugins css files, forcing me to use a lot of !important for my styles to actually show.

I’m thinking this can be avoided if my styles are included last, after every third party style. Can I do this with Sage? Or would there be a better way to achieve this?

Thanks a lot!

Sage uses wp_enqueue_style to load the main styles, so any standard WordPress solution would work.

You can also use more specific selectors in your main styles, so that they won’t be overridden by the plugin later.

1 Like

Hi, thanks for your reply.

Could you be more specific about what you mean by standard wordpress solution?

Regarding the selectors, I’m actually worried that the sass files I’m writing to override buddypress styles are too nested, resulting in poor css. And even like this, I still have to use a lot of !importants…

Any WordPress solution you would find by reading the codex or posting on WordPress development.

1 Like