Last active
January 31, 2025 12:12
-
-
Save esedic/5d02372b537bffc5d71e1f8ac4f534ed to your computer and use it in GitHub Desktop.
Set timestamp to Wordpress child theme custom CSS file
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 | |
function my_child_theme_enqueue_styles() { | |
$css_file = get_stylesheet_directory() . '/css/style.css'; | |
$css_url = get_stylesheet_directory_uri() . '/css/style.css'; | |
wp_enqueue_style( | |
'child-style', | |
$css_url, | |
array(), // No dependencies | |
file_exists($css_file) ? filemtime($css_file) : null // Adds timestamp version | |
); | |
} | |
add_action('wp_enqueue_scripts', 'my_child_theme_enqueue_styles'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment