Skip to content

Instantly share code, notes, and snippets.

@raideus
Created May 16, 2013 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raideus/5592475 to your computer and use it in GitHub Desktop.
Save raideus/5592475 to your computer and use it in GitHub Desktop.
Anti-caching tactic for stylesheets and scripts
<?php
function gs_scripts_styles() {
$version = '1';
if (defined('WP_DEBUG') && WP_DEBUG) $version = date('his');
elseif (defined('ENV_STAGING') && ENV_STAGING) $version = date('his');
wp_enqueue_style( 'gs-theme-styles', get_template_directory_uri() . '/style.css', array('gs-grid-styles'), $version, 'all' );
wp_enqueue_script( 'gs-scripts', get_template_directory_uri() . '/js/scripts.js', array( 'modernizr', 'jquery' ), $version, true );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment