Created
October 30, 2014 21:50
-
-
Save plasticmind/94107399237599755f07 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// == Create a simple hash based on a file checksum | |
function sr_version_hash($file) { | |
if(!$file) return false; | |
$full_path = get_template_directory() . $file; | |
return hash_file('CRC32',$full_path); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Call to it in the fourth argument (version) of your enqueue_script function, like this:
wp_enqueue_script('sr-tools', get_template_directory_uri() . '/assets/js/tools.min.js', array('jquery'), sr_version_hash(get_template_directory_uri().'/assets/js/tools.min.js'), true );
Works the same with wp_enqueue_stylesheet.