I want to override my plugin CSS settings, but I can't do that in my style.css
file, because the plugin CSS gets loaded after.
Is there a way of getting style to be applied to override plugin CSS?
|
Include overrides after wp_head / wp_footer actionsThe plugin's stylesheet(s) are most likely inserted into the page using WordPress' enqueue functions. If so, scripts and stylesheets will be added either where Hence, if you want to override plugin css, the stylesheet responsible should be loaded at a later point. Going with the default option of the sheet being inserted into the header, a mock-up snippet of header code could look like this:
Proper Enqueueing with dependenciesAlternatively, you could (should) properly enqueue the stylesheet with the overrides yourself and make it dependent (WP will then load it after the dependency) on the plugin's stylesheet. In order to be able to do so, you'd have to examine the plugin code, and find the handle of the stylesheet to reference it as a dependency when registering your own. Then, in your theme's functions.php file, you'd add the following:
|
||||
|
Will be interesting know which answer developers think is 'better', so as an alternative to Johanne's answer (which can present difficulties if the plug-in loads scripts late, or starts moving them around without warning) Prevent the stylesheet from loadingIf you've included all necessary styling in your
This has the advantage of not requiring additional stylesheets to be loaded - but the plug-in's CSS is then included in all page loads, so this may not be desirable. Replacing the stylesheetOtherwise, you can copy the stylesheet into your theme, edit and then ensure WordPress uses it instead:
|
|||
|