Load / Enqueue the latest version of css and javascript files

Add the following code to your functions.php file to load / enqueue the most recent child theme style.css file or any css/javascript file.

$cache_buster = date("YmdHi");
function my_custom_files() {
wp_register_style( 'childstyle', get_stylesheet_directory_uri() . '/style.css', $cache_buster, 'all' );
wp_enqueue_script( 'my-scripts', get_stylesheet_directory_uri() . '/scripts.js', array(), $cache_buster, true );
wp_enqueue_style( 'childstyle' );
}
add_action( 'wp_enqueue_scripts', 'my_custom_files', 11);

Leave a Reply

Your email address will not be published. Required fields are marked *