Themes: Add version to theme screenshot URL for better browser cache handling.
This change appends the theme version number to the URL of screenshots that appear in various place of the WordPress Admin. As a result, browsers will be able to refresh the screenshot as needed when the theme is updated. Props codente, desrosj, audrasjb, SergeyBiryukov. Fixes #53370. Built from https://develop.svn.wordpress.org/trunk@52947 git-svn-id: http://core.svn.wordpress.org/trunk@52536 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d6589948ca
commit
a32545f854
|
@ -359,7 +359,7 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
|
|||
|
||||
?>
|
||||
<a class="screenshot install-theme-preview" href="<?php echo esc_url( $preview_url ); ?>" title="<?php echo esc_attr( $preview_title ); ?>">
|
||||
<img src="<?php echo esc_url( $theme->screenshot_url ); ?>" width="150" alt="" />
|
||||
<img src="<?php echo esc_url( $theme->screenshot_url . '?ver=' . $theme->version ); ?>" width="150" alt="" />
|
||||
</a>
|
||||
|
||||
<h3><?php echo $name; ?></h3>
|
||||
|
@ -502,7 +502,7 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
|
|||
?>
|
||||
</span>
|
||||
<?php if ( isset( $theme->screenshot_url ) ) : ?>
|
||||
<img class="theme-screenshot" src="<?php echo esc_url( $theme->screenshot_url ); ?>" alt="" />
|
||||
<img class="theme-screenshot" src="<?php echo esc_url( $theme->screenshot_url . '?ver=' . $theme->version ); ?>" alt="" />
|
||||
<?php endif; ?>
|
||||
<div class="theme-details">
|
||||
<?php
|
||||
|
|
|
@ -823,7 +823,7 @@ function customize_themes_print_templates() {
|
|||
<div class="theme-about wp-clearfix">
|
||||
<div class="theme-screenshots">
|
||||
<# if ( data.screenshot && data.screenshot[0] ) { #>
|
||||
<div class="screenshot"><img src="{{ data.screenshot[0] }}" alt="" /></div>
|
||||
<div class="screenshot"><img src="{{ data.screenshot[0] }}?ver={{ data.version }}" alt="" /></div>
|
||||
<# } else { #>
|
||||
<div class="screenshot blank"></div>
|
||||
<# } #>
|
||||
|
|
|
@ -282,7 +282,7 @@ if ( $tab ) {
|
|||
<script id="tmpl-theme" type="text/template">
|
||||
<# if ( data.screenshot_url ) { #>
|
||||
<div class="theme-screenshot">
|
||||
<img src="{{ data.screenshot_url }}" alt="" />
|
||||
<img src="{{ data.screenshot_url }}?ver={{ data.version }}" alt="" />
|
||||
</div>
|
||||
<# } else { #>
|
||||
<div class="theme-screenshot blank"></div>
|
||||
|
@ -456,7 +456,7 @@ if ( $tab ) {
|
|||
?>
|
||||
</span>
|
||||
|
||||
<img class="theme-screenshot" src="{{ data.screenshot_url }}" alt="" />
|
||||
<img class="theme-screenshot" src="{{ data.screenshot_url }}?ver={{ data.version }}" alt="" />
|
||||
|
||||
<div class="theme-details">
|
||||
<# if ( data.rating ) { #>
|
||||
|
|
|
@ -388,7 +388,7 @@ foreach ( $themes as $theme ) :
|
|||
<div class="theme<?php echo $active_class; ?>">
|
||||
<?php if ( ! empty( $theme['screenshot'][0] ) ) { ?>
|
||||
<div class="theme-screenshot">
|
||||
<img src="<?php echo esc_attr( $theme['screenshot'][0] ); ?>" alt="" />
|
||||
<img src="<?php echo esc_attr( $theme['screenshot'][0] . '?ver=' . $theme['version'] ); ?>" alt="" />
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<div class="theme-screenshot blank"></div>
|
||||
|
@ -739,7 +739,7 @@ function wp_theme_auto_update_setting_template() {
|
|||
<script id="tmpl-theme" type="text/template">
|
||||
<# if ( data.screenshot[0] ) { #>
|
||||
<div class="theme-screenshot">
|
||||
<img src="{{ data.screenshot[0] }}" alt="" />
|
||||
<img src="{{ data.screenshot[0] }}?ver={{ data.version }}" alt="" />
|
||||
</div>
|
||||
<# } else { #>
|
||||
<div class="theme-screenshot blank"></div>
|
||||
|
@ -947,7 +947,7 @@ function wp_theme_auto_update_setting_template() {
|
|||
<div class="theme-about wp-clearfix">
|
||||
<div class="theme-screenshots">
|
||||
<# if ( data.screenshot[0] ) { #>
|
||||
<div class="screenshot"><img src="{{ data.screenshot[0] }}" alt="" /></div>
|
||||
<div class="screenshot"><img src="{{ data.screenshot[0] }}?ver={{ data.version }}" alt="" /></div>
|
||||
<# } else { #>
|
||||
<div class="screenshot blank"></div>
|
||||
<# } #>
|
||||
|
|
|
@ -755,7 +755,7 @@ function list_theme_updates() {
|
|||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="plugin-title"><p>
|
||||
<img src="<?php echo esc_url( $theme->get_screenshot() ); ?>" width="85" height="64" class="updates-table-screenshot" alt="" />
|
||||
<img src="<?php echo esc_url( $theme->get_screenshot() . '?ver=' . $theme->version ); ?>" width="85" height="64" class="updates-table-screenshot" alt="" />
|
||||
<strong><?php echo $theme->display( 'Name' ); ?></strong>
|
||||
<?php
|
||||
printf(
|
||||
|
|
|
@ -74,7 +74,7 @@ class WP_Customize_Theme_Control extends WP_Customize_Control {
|
|||
|
||||
<# if ( data.theme.screenshot && data.theme.screenshot[0] ) { #>
|
||||
<div class="theme-screenshot">
|
||||
<img data-src="{{ data.theme.screenshot[0] }}" alt="" />
|
||||
<img data-src="{{ data.theme.screenshot[0] }}?ver={{ data.theme.version }}" alt="" />
|
||||
</div>
|
||||
<# } else { #>
|
||||
<div class="theme-screenshot blank"></div>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.0-alpha-52946';
|
||||
$wp_version = '6.0-alpha-52947';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue