Adding timestamp to js/css resources - Thx @gintsmurans

https://github.com/understrap/understrap/issues/631
This commit is contained in:
Holger Könemann 2018-04-06 19:43:18 +02:00
parent 214ed46dea
commit 4fb9fdd96d
1 changed files with 9 additions and 2 deletions

View File

@ -12,9 +12,16 @@ if ( ! function_exists( 'understrap_scripts' ) ) {
function understrap_scripts() { function understrap_scripts() {
// Get the theme data. // Get the theme data.
$the_theme = wp_get_theme(); $the_theme = wp_get_theme();
wp_enqueue_style( 'understrap-styles', get_stylesheet_directory_uri() . '/css/theme.min.css', array(), $the_theme->get( 'Version' ) ); $theme_version = $the_theme->get( 'Version' );
$css_version = $theme_version . '.' . filemtime(get_template_directory() . '/css/theme.min.css');
wp_enqueue_style( 'understrap-styles', get_stylesheet_directory_uri() . '/css/theme.min.css', array(), $css_version );
wp_enqueue_script( 'jquery'); wp_enqueue_script( 'jquery');
wp_enqueue_script( 'popper-scripts', get_template_directory_uri() . '/js/popper.min.js', array(), true); wp_enqueue_script( 'popper-scripts', get_template_directory_uri() . '/js/popper.min.js', array(), $theme_version, true);
$js_version = $theme_version . '.' . filemtime(get_template_directory() . '/js/theme.min.js');
wp_enqueue_script( 'understrap-scripts', get_template_directory_uri() . '/js/theme.min.js', array(), $js_version, true );
wp_enqueue_script( 'understrap-scripts', get_template_directory_uri() . '/js/theme.min.js', array(), $the_theme->get( 'Version' ), true ); wp_enqueue_script( 'understrap-scripts', get_template_directory_uri() . '/js/theme.min.js', array(), $the_theme->get( 'Version' ), true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' ); wp_enqueue_script( 'comment-reply' );