Bundled Themes: Use the theme version when enqueuing theme specific stylesheets.

For many bundled theme related stylesheets, a version is either not specified, or specified as a hardcoded date string when enqueued. This is problematic when a stylesheet is updated and the version number is not (which has happened several times recently). This change ensures that all bundled theme related stylesheets use the theme’s version as the stylesheet version. This ensures cache busting for theme stylesheets every time a theme is updated and guarantees that users receive any new or updated styles included in the update when visiting the site for the first time after an update.

Props parsmizban, ianbelanger, dswebsme.
Fixes #39997.
Built from https://develop.svn.wordpress.org/trunk@45213


git-svn-id: http://core.svn.wordpress.org/trunk@45022 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2019-04-16 14:56:51 +00:00
parent 3f14f7ea2a
commit 67e75d5fb3
1 changed files with 4 additions and 4 deletions

View File

@ -199,13 +199,13 @@ function twentytwelve_scripts_styles() {
}
// Loads our main stylesheet.
wp_enqueue_style( 'twentytwelve-style', get_stylesheet_uri() );
wp_enqueue_style( 'twentytwelve-style', get_stylesheet_uri(), array(), wp_get_theme()->get( 'Version' ) );
// Theme block stylesheet.
wp_enqueue_style( 'twentytwelve-block-style', get_template_directory_uri() . '/css/blocks.css', array( 'twentytwelve-style' ), '20181230' );
wp_enqueue_style( 'twentytwelve-block-style', get_template_directory_uri() . '/css/blocks.css', array( 'twentytwelve-style' ), wp_get_theme()->get( 'Version' ) );
// Loads the Internet Explorer specific stylesheet.
wp_enqueue_style( 'twentytwelve-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentytwelve-style' ), '20121010' );
wp_enqueue_style( 'twentytwelve-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentytwelve-style' ), wp_get_theme()->get( 'Version' ) );
$wp_styles->add_data( 'twentytwelve-ie', 'conditional', 'lt IE 9' );
}
add_action( 'wp_enqueue_scripts', 'twentytwelve_scripts_styles' );
@ -217,7 +217,7 @@ add_action( 'wp_enqueue_scripts', 'twentytwelve_scripts_styles' );
*/
function twentytwelve_block_editor_styles() {
// Block styles.
wp_enqueue_style( 'twentytwelve-block-editor-style', get_template_directory_uri() . '/css/editor-blocks.css', array(), '20181230' );
wp_enqueue_style( 'twentytwelve-block-editor-style', get_template_directory_uri() . '/css/editor-blocks.css', array(), wp_get_theme()->get( 'Version' ) );
// Add custom fonts.
wp_enqueue_style( 'twentytwelve-fonts', twentytwelve_get_font_url(), array(), null );
}