Created
December 23, 2024 11:20
-
-
Save autocircled/b04e1cfd4e99bba493bcad64bf3f6267 to your computer and use it in GitHub Desktop.
WordPress Child Theme Cache Buster
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
define('DSK_VERSION', '1.1.4'); | |
$cache_buster = DSK_VERSION; | |
if ( defined( 'WP_DEBUG' ) && WP_DEBUG) { | |
$cache_buster = date("YmdHi", filemtime( get_stylesheet_directory() . '/css/main.css')); | |
} | |
function my_scripts_and_styles(){ | |
global $cache_buster; | |
wp_enqueue_style( 'main-style', get_stylesheet_directory_uri() . '/css/main.css', array( 'woodmart-style' ), $cache_buster, 'all' ); | |
} | |
add_action( 'wp_enqueue_scripts', 'my_scripts_and_styles', 99999); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment