Title: Conditionally add CSS?
Last modified: February 7, 2018

---

# Conditionally add CSS?

 *  Resolved [gmariani405](https://wordpress.org/support/users/gmariani405/)
 * (@gmariani405)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/conditionally-add-css/)
 * Is there a way to only have the CSS added to a page where the calendar is actually
   used? It seems to add it’s code and CSs on ALL pages, not just the one page that
   uses it. Can this be changed?

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

 *  Plugin Author [Spiffy Plugins](https://wordpress.org/support/users/spiffyplugins/)
 * (@spiffyplugins)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/conditionally-add-css/#post-9952668)
 * Is there any particular reason why you want to do this? Browsers cache the CSS
   files, so it doesn’t make much difference in page loading and it would involve
   scanning each page for instances of all the shortcodes and widgets.
 *  Thread Starter [gmariani405](https://wordpress.org/support/users/gmariani405/)
 * (@gmariani405)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/conditionally-add-css/#post-9953875)
 * The issue is that the plugin is not relying on CSS in files, it’s writing it 
   inline. Looking into it closer, the issue revolves around the Custom CSS option.
   That writes the CSS inline and not as a file. Please look at this page, you can
   see the <style id=’spiffycal-styles-inline-css’ type=’text/css’> inline:
    [http://dev14.coursevector.com/contact-us/](http://dev14.coursevector.com/contact-us/)
 * Here is the only page the calendar is actually used on: [http://dev14.coursevector.com/news-events/calendar-of-events/](http://dev14.coursevector.com/news-events/calendar-of-events/)
 * But, even if you are referring to a file, shouldn’t it only be enqueued if the
   shortcode is being used on that page?
 * WordPress and caching plugins are able to run more efficiently the less CSS/JS
   that is written inline and more that is enqueued.
 *  Plugin Author [Spiffy Plugins](https://wordpress.org/support/users/spiffyplugins/)
 * (@spiffyplugins)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/conditionally-add-css/#post-9954324)
 * The plugin uses a combination of a default file, with custom CSS added inline.
 * I will look into the possibility of splitting the enqueue into a register/enqueue
   pairing if that still works with inline CSS.
 *  Plugin Author [Spiffy Plugins](https://wordpress.org/support/users/spiffyplugins/)
 * (@spiffyplugins)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/conditionally-add-css/#post-9956990)
 * Please try version 3.5.10 of the plugin, which has been updated to resolve this.
 *  Thread Starter [gmariani405](https://wordpress.org/support/users/gmariani405/)
 * (@gmariani405)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/conditionally-add-css/#post-9957561)
 * Excellent, I still see the inline CSS but as long as it’s only the calendar page
   that’s good enough for me. thank you for the quick turnaround!

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

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

 * ![](https://ps.w.org/spiffy-calendar/assets/icon-256x256.png?rev=2398731)
 * [Spiffy Calendar](https://wordpress.org/plugins/spiffy-calendar/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/spiffy-calendar/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/spiffy-calendar/)
 * [Active Topics](https://wordpress.org/support/plugin/spiffy-calendar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/spiffy-calendar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/spiffy-calendar/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [gmariani405](https://wordpress.org/support/users/gmariani405/)
 * Last activity: [8 years, 3 months ago](https://wordpress.org/support/topic/conditionally-add-css/#post-9957561)
 * Status: resolved