Created
September 25, 2022 10:06
-
-
Save stefanmm/4f03a17c4999e966e0553a884ff26dcd to your computer and use it in GitHub Desktop.
WP enqueue scripts, ignore caching
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 | |
// Enqueue JS and CSS | |
function enqueue_scripts_44587912556() { | |
$js_ver_stamp = filemtime( plugin_dir_path( __FILE__ ) . 'js/scripts.js' ); // Get timestamp of the file | |
$css_ver_stamp = filemtime( plugin_dir_path( __FILE__ ) . 'css/styles.js' ); // Get timestamp of the file | |
wp_enqueue_script('my_scripts', plugins_url( 'js/scripts.js', __FILE__ ), array(), $js_ver_stamp); // Append timestamp of the file | |
wp_register_style('my_styles', plugins_url( 'css/styles.css', __FILE__ ), false, $css_ver_stamp); // Append timestamp of the file | |
wp_enqueue_style ('my_styles'); | |
} | |
add_action('wp_enqueue_scripts', 'enqueue_scripts_44587912556'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment