Support » Plugin: Scriptless Social Sharing » Loading CSS Conditionally

  • Resolved Karis

    (@askel45)


    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

    (@littlerchicken)

    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.

    Karis

    (@askel45)

    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

    (@littlerchicken)

    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.

    Karis

    (@askel45)

    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.