Make WordPress Core

Changeset 31129


Ignore:
Timestamp:
01/10/2015 08:43:12 PM (10 years ago)
Author:
wonderboymusic
Message:

Since get_theme_mod() returns false on failure, $background_image_thumb can be set to it and checked instead of calling get_background_image() 3 times in Custom_Background->admin_page().

See #30799.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/custom-background.php

    r31125 r31129  
    279279            $background_styles .= 'background-color: #' . $bgcolor . ';';
    280280
    281         if ( get_background_image() ) {
    282             $background_image_thumb = esc_url( set_url_scheme( get_theme_mod( 'background_image_thumb', str_replace( '%', '%%', get_background_image() ) ) ) );
     281        $background_image_thumb = get_background_image();
     282        if ( $background_image_thumb ) {
     283            $background_image_thumb = esc_url( set_url_scheme( get_theme_mod( 'background_image_thumb', str_replace( '%', '%%', $background_image_thumb ) ) ) );
    283284
    284285            // Background-image URL must be single quote, see below.
     
    289290    ?>
    290291    <div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // must be double quote, see above ?>
    291         <?php if ( get_background_image() ) { ?>
     292        <?php if ( $background_image_thumb ) { ?>
    292293        <img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" /><br />
    293294        <img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" />
Note: See TracChangeset for help on using the changeset viewer.