Make WordPress Core

Ticket #53370: 53370.1.diff

File 53370.1.diff, 1.7 KB (added by audrasjb, 2 years ago)

Themes: Add version to theme screenshot URL for better browser cache refreshing

  • src/wp-admin/themes.php

    diff --git a/src/wp-admin/themes.php b/src/wp-admin/themes.php
    index 87b1b6db7a..9ee06bfaf5 100644
    a b foreach ( $themes as $theme ) : 
    374374<div class="theme<?php echo $active_class; ?>">
    375375        <?php if ( ! empty( $theme['screenshot'][0] ) ) { ?>
    376376                <div class="theme-screenshot">
    377                         <img src="<?php echo $theme['screenshot'][0]; ?>" alt="" />
     377                        <img src="<?php echo $theme['screenshot'][0] . '?ver=' . $theme['version']; ?>" alt="" />
    378378                </div>
    379379        <?php } else { ?>
    380380                <div class="theme-screenshot blank"></div>
    function wp_theme_auto_update_setting_template() { 
    725725<script id="tmpl-theme" type="text/template">
    726726        <# if ( data.screenshot[0] ) { #>
    727727                <div class="theme-screenshot">
    728                         <img src="{{ data.screenshot[0] }}" alt="" />
     728                        <img src="{{ data.screenshot[0] }}?ver={{ data.version }}" alt="" />
    729729                </div>
    730730        <# } else { #>
    731731                <div class="theme-screenshot blank"></div>
  • src/wp-includes/customize/class-wp-customize-theme-control.php

    diff --git a/src/wp-includes/customize/class-wp-customize-theme-control.php b/src/wp-includes/customize/class-wp-customize-theme-control.php
    index a0a705d545..baca767286 100644
    a b class WP_Customize_Theme_Control extends WP_Customize_Control { 
    7474
    7575                        <# if ( data.theme.screenshot && data.theme.screenshot[0] ) { #>
    7676                                <div class="theme-screenshot">
    77                                         <img data-src="{{ data.theme.screenshot[0] }}" alt="" />
     77                                        <img data-src="{{ data.theme.screenshot[0] }}?ver={{ data.theme.version }}" alt="" />
    7878                                </div>
    7979                        <# } else { #>
    8080                                <div class="theme-screenshot blank"></div>