I am in a situation where I have two WordPress plugins that include the jquery-ui.css and the last plugin that gets loaded overwrites the first plugin’s css. I would like both themes to load. I know the jQuery theme builder supports CSS scoping, but neither of these plugins take advantage of this feature, and editing the plugin isn’t a reasonable option (since changes will be overwritten next time I update the plugin). Is there any way I can programmatically implement the scoping, by adding some JavaScript to my theme?
Share
First, you have to be able to scope at least one of the plugins’ output by marking its container (or use additional wrapping ) by some
class. For thatclassto take effect you need to download a new package build fillingCSS Scopewith yourclassselector that would be.class.Theme Folder Nameis where your new scoped css will be into. Check this page for details.WordPress
To keep things nice and clear under WordPress, register new CSS. Inside your theme’s
functions.php:Last, enqueue this styles where you need them. Common way to do that is to hook following line to
wp_print_stylesaction.