Created
December 1, 2017 18:43
-
-
Save royce002/7554295e87815c1ffdfcfdbb44bb3535 to your computer and use it in GitHub Desktop.
Enqueue Scripts and styles with timestamp versioning for functions.php in WordPress
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
/** | |
* Enqueue Styles & Scripts w/ a hook | |
*/ | |
function enqueue_styles_scripts_versioning() { | |
wp_enqueue_style('main-styles', get_template_directory_uri() . '/css/style.css', array(), filemtime(get_template_directory() . '/css/style.css'), false); | |
wp_enqueue_script( 'main-styles', get_template_directory_uri() . '/js/example.js', array(), filemtime(get_template_directory() . '/js/example.js'), true ); | |
} | |
add_action( 'wp_enqueue_scripts', 'enqueue_styles_scripts_versioning' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome :)