Last active
April 26, 2017 18:16
-
-
Save galengidman/ca1b79acc22cf01f920ca9ad63eb1caf 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
<?php | |
function gg_asset_url( $path = '' ) { | |
return esc_url( get_template_directory_uri() . '/assets/' . $path ); | |
} | |
function gg_asset_path( $path = '' ) { | |
return get_template_directory() . '/assets/' . $path; | |
} | |
function gg_assets() { | |
wp_enqueue_style( | |
'gg-style', // name | |
gg_asset_url( 'css/style.css' ), // file URL | |
array(), // dependencies | |
filemtime( gg_asset_path( 'css/style.css' ) ) // `ver` paramater value | |
); | |
wp_enqueue_script( | |
'gg-script', // name | |
gg_asset_url( 'js/script.js' ), // file URL | |
array( 'jquery' ), // dependencies | |
filemtime( gg_asset_path( 'js/script.js' ) ), // `ver` paramater value | |
); | |
} | |
add_action( 'wp_enqueue_scripts', 'gg_assets' ); |
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
<link rel="stylesheet" href="my/css/file.css?ver=<?php echo filemtime(__DIR__ . '/my/css/file.css'); ?>"> | |
<script src="my/js/file.js?ver=<?php echo filemtime(__DIR__ . '/my/js/file.js'); ?>"></script> |
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
<link rel="stylesheet" href="my/css/file.css?ver=<?php echo time(); ?>"> | |
<script src="my/js/file.js?ver=<?php echo time(); ?>"></script> |
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
<link rel="stylesheet" href="my/css/file.css?ver=1"> | |
<script src="my/js/file.js?ver=1"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment