Last active
October 5, 2016 20:10
-
-
Save vahidd/1ae6b0dd2d2596f035bb5119b34cf6cf to your computer and use it in GitHub Desktop.
WordPress dynamic file version based on file content
This file contains hidden or 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 | |
| add_action( 'wp_enqueue_scripts', function () { | |
| $fileURI = trailingslashit( get_template_directory_uri() ) . 'styles.css'; | |
| $filePath = trailingslashit( get_template_directory() ) . 'styles.css'; | |
| // Or wp_enqueue_style | |
| wp_enqueue_script( | |
| 'some-script', | |
| $fileURI, | |
| array(), // Script dependencies | |
| hash_file( 'md5', $filePath ) | |
| ); | |
| } ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment