Title: Loading CSS Conditionally
Last modified: June 18, 2020

---

# Loading CSS Conditionally

 *  Resolved [Karis](https://wordpress.org/support/users/askel45/)
 * (@askel45)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/loading-css-conditionally/)
 * Howdy Robin. Is it possible to either load the plugin’s CSS conditionally depending
   on the icons being used, or could you provide a way to only enqueue the CSS separately(
   in my theme) for only the icons I am using (I have created an SVG sprite of the
   only icons I am using and calling it in my functions.php)? Thank you in advance.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Robin Cornett](https://wordpress.org/support/users/littlerchicken/)
 * (@littlerchicken)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/loading-css-conditionally/#post-13008988)
 * If you have set up an SVG sprite for your icons, that should be all you need 
   to do. The plugin has one general CSS rule to manage the SVG icons–the only CSS
   that is specific to a particular button manages the background colors. The plugin
   styles are already set up to load conditionally, but can be disabled from the
   plugin settings screen if you want to set up your own styles in your theme.
 *  Thread Starter [Karis](https://wordpress.org/support/users/askel45/)
 * (@askel45)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/loading-css-conditionally/#post-13010802)
 * I checked my CSS stylesheet (ctrl+u) and it showed all the icons CSS being loaded,
   including CSS for pocket icons which I noticed, which I don’t use.
 *  Plugin Author [Robin Cornett](https://wordpress.org/support/users/littlerchicken/)
 * (@littlerchicken)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/loading-css-conditionally/#post-13011041)
 * If you do not want the plugin styles to load, you can uncheck the “Load the main
   stylesheet” option on the plugin settings page, and add your preferred styles
   to your theme.
 * I may be misunderstanding what you are asking–are you wanting to prevent the 
   CSS for a specific icon loading (if you are using SVG, it should only be the 
   color styles), or the icon itself? If you have set up your own icon sprite file
   in your theme and the plugin icons are still loading, we may need to double check
   the code you are using to replace the sprite file.
 * A link so that I can see the affected post may also be helpful, so that I can
   see the same thing you are.
 *  Thread Starter [Karis](https://wordpress.org/support/users/askel45/)
 * (@askel45)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/loading-css-conditionally/#post-13011275)
 * It was the styles of the icons that I was referring to that I don’t want to load.
   I tried unchecking the theme style options but replicating the full width is 
   not as fluid as the plugin does it.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Loading CSS Conditionally’ is closed to new replies.

 * ![](https://ps.w.org/scriptless-social-sharing/assets/icon-256x256.jpg?rev=1361689)
 * [Scriptless Social Sharing](https://wordpress.org/plugins/scriptless-social-sharing/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/scriptless-social-sharing/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/scriptless-social-sharing/)
 * [Active Topics](https://wordpress.org/support/plugin/scriptless-social-sharing/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/scriptless-social-sharing/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/scriptless-social-sharing/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Karis](https://wordpress.org/support/users/askel45/)
 * Last activity: [5 years, 11 months ago](https://wordpress.org/support/topic/loading-css-conditionally/#post-13011275)
 * Status: resolved