Designs By Nick the Geek

Genesis Based WordPress Development and Tutorials for Everyone

  • Email
  • GitHub
  • Twitter
  • Home
  • About
    • My Experience As…
    • Bedtime Stories by Me
  • Themes
  • Genesis Explained
    • Actions
    • Filters
    • Functions
    • Admin
  • Plugins
  • Themes
    • Free
      • Fluid
  • Tutorials
    • Quick Tips
nickthegeek December 28, 2011

Versioning Your Stylesheet

Hi folks, I haven’t written any tutorials for a while, I’m waiting on Genesis 1.8 to finish my Genesis Explained series because there are some changes coming to the admin system that would render most of what I said moot.

In the interim, I wanted to get some quick tips out there. Little tricks I use on my site or when developing for clients.

One thing that gets really annoying is cached style sheets. They are a good thing and I would never want to disable them, but if I make a change on my site, like the Child Theme Matrix, and a user has a cached version of my style sheet, things won’t look right. Likewise, when I developing for clients and make a change I want them to see, they won’t see it. The end user can do a hard refresh (ctrl+f5 on the PC) but that’s asking a lot, especially for changes on my site.

That’s why I version my style sheet. The code is really simple and it lets me update the style sheet the world sees when they visit my site. Right now this is what it looks like in my functions.php file

remove_action('genesis_meta', 'genesis_load_stylesheet');
add_action('genesis_meta', 'ntg_load_stylesheet');
/**
 * Loads Versions Style Sheet
 * 
 * @uses wp_enqueue_style()
 * @author Nick the Geek
 *
 */
function ntg_load_stylesheet() {

    wp_enqueue_style( 'ntg-style', get_bloginfo('stylesheet_url'), array(), '1.0.1.4', 'screen' );

}

If I make a CSS change I need to push to the world, I can change “1.0.1.4” to “1.0.1.5”

Hope this helps.

If you liked this article, tell someone about it

Previous Article

This is the first article in the series

Next Article

Sorting Made SimpleChanging Archive Sorting

Related Posts

  • Genesis Responsive Header Updated
  • Genesis Responsive Header
  • How I Make Custom Fields Easier in Genesis
  • How I Added Custom Fields to the Genesis Responsive Slider
  • A Better Home Page

Filed Under: Tutorials Tagged: GenesisWP, Quick Tips

Comments

  1. Eric says

    January 5, 2012 at 10:49 am

    Any idea on when 1.8 is being released?

    Thanks for the articles they have helped me a TON.

    • nickthegeek says

      January 5, 2012 at 4:43 pm

      Genesis 1.8 should be coming out VERY soon. The last bits and bobs are being taken care of then it will be released as a beta for field testing.

  2. Dave Tasker says

    January 21, 2012 at 1:48 pm

    On a slightly different tack Nick…
    I maintain a couple of themes for about 20 departments in our School, and short of hosting them all on a WordPress network it would be really cool if I could alert administrators through their WordPress Update screens when I updated the theme. Is there any way I can do this without hosting the themes on WordPress.org?
    PLease forgive me if this is an inappropriate place to post this question!
    Thanks for your posts btw – really enjoy reading them 🙂

  3. JPry says

    June 25, 2012 at 4:55 pm

    Hey Nick,

    Thanks for sharing this. I remember when you first posted it months ago, and I just finally came back to it and implemented it myself. I made a slight change to your code using the new WP_Theme class that came with WordPress 3.4, so that your version number only has to exist in one place: the style.css file.

    Check it out: https://gist.github.com/2991153

Copyright © 2025 Nick the Geek ·Built on the Genesis Theme Framework using the Streamline 2.0 theme · Log in