Simple Calendar - Google Calendar Plugin
[Plugin: Google Calendar Events] Using custom stylesheet but still loading default (3 posts)

  1. Helen Hou-Sandi
    WordPress Dev
    Posted 5 years ago #

    I have a custom stylesheet defined which does get enqueued but so does the default CSS, which occasionally overrides what's defined in the custom stylesheet. I don't remember this happening in the last version (though I could definitely be wrong) - could there be an option to not load the default stylesheet? Then the CSS could even be defined in the plain old styles.css file if desired.


  2. Ross Hanney
    Plugin Contributor

    Posted 5 years ago #

    Hi Helen,

    This was an intentional change. Previously, if your custom stylesheet was overwritten (which would happen during plugin updates if the custom stylesheet was placed in the plugin directory), there would be no default stylesheet to fall back on. This would cause layout problems, especially for calendar grids (there's a very important display:none in there!).

    Now, your custom stylesheet is always enqueued after the default plugin stylesheet, so as long as your style rules are correctly defined (i.e specific enough), the default styles won't override your custom ones. This also means you only need to include the styles you want to override in your custom stylesheet, not everything from the default.

    By styles.css, do you mean your theme's stylesheet? I don't think it's a good idea to rely on the theme stylesheet, as if you change your theme, the styles would be lost, and the same layout issues mentioned above would occur.

    If you do still want to stop the default stylesheet from loading, you could add the following to the theme's functions.php file:

    add_action('wp_print_styles', 'deregister_gce_stylesheet', 100);
    function deregister_gce_stylesheet(){

    This would cause only your custom stylesheet to load. I would advise against doing this for the reasons discussed, but if you're sure that your custom stylesheet won't get lost / overwritten, then this will work.

    Also, if you did want to rely on your theme's stylesheet, and not load any plugin stylesheets, you would adjust the above code to this:

    add_action('wp_print_styles', 'deregister_gce_stylesheet', 100);
    function deregister_gce_stylesheet(){

    Again, not recommended!

    I hope this helps, let me know if you have any further questions.


  3. Helen Hou-Sandi
    WordPress Dev
    Posted 5 years ago #

    Hi Ross,

    Thank you for your quick response! I understand the reasoning, and figured out why one of my rules was being overridden, so all seems well in my particular use case.

    And yes, I did mean the theme's style.css (not styles.css, oops!). I use WordPress largely as a CMS for clients, so the chances of custom stylesheets being overwritten is (almost) non-existent. But, just deregistering things in that case works just as well as any option :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Simple Calendar - Google Calendar Plugin
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic