Make WordPress Core

Ticket #26731: 26731.diff

File 26731.diff, 3.2 KB (added by obenland, 12 years ago)
  • wp-admin/custom-background.php

     
    184184<div id="message" class="updated">
    185185<p><?php printf( __( 'Background updated. <a href="%s">Visit your site</a> to see how it looks.' ), home_url( '/' ) ); ?></p>
    186186</div>
    187 <?php }
     187<?php } ?>
    188188
    189         if ( $this->admin_image_div_callback ) {
    190                 call_user_func($this->admin_image_div_callback);
    191         } else {
    192 ?>
    193189<h3><?php _e('Background Image'); ?></h3>
    194190<table class="form-table">
    195191<tbody>
    196192<tr valign="top">
    197193<th scope="row"><?php _e('Preview'); ?></th>
    198194<td>
    199 <?php
    200 $background_styles = '';
    201 if ( $bgcolor = get_background_color() )
    202         $background_styles .= 'background-color: #' . $bgcolor . ';';
     195        <?php
     196                if ( $this->admin_image_div_callback ) {
     197                        call_user_func($this->admin_image_div_callback);
     198                } else {
     199                        $background_styles = '';
     200                        if ( $bgcolor = get_background_color() )
     201                                $background_styles .= 'background-color: #' . $bgcolor . ';';
    203202
    204 if ( get_background_image() ) {
    205         $background_image_thumb = esc_url( set_url_scheme( get_theme_mod( 'background_image_thumb', str_replace( '%', '%%', get_background_image() ) ) ) );
    206         // background-image URL must be single quote, see below
    207         $background_styles .= ' background-image: url(\'' . $background_image_thumb . '\');'
    208                 . ' background-repeat: ' . get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) . ';'
    209                 . ' background-position: top ' . get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
    210 }
    211 ?>
    212 <div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // must be double quote, see above ?>
    213 <?php if ( get_background_image() ) { ?>
    214 <img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" /><br />
    215 <img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" />
    216 <?php } ?>
    217 </div>
    218 <?php } ?>
     203                        if ( get_background_image() ) {
     204                                $background_image_thumb = esc_url( set_url_scheme( get_theme_mod( 'background_image_thumb', str_replace( '%', '%%', get_background_image() ) ) ) );
     205                                // background-image URL must be single quote, see below
     206                                $background_styles .= ' background-image: url(\'' . $background_image_thumb . '\');'
     207                                        . ' background-repeat: ' . get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) . ';'
     208                                        . ' background-position: top ' . get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
     209                        }
     210        ?>
     211        <div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // must be double quote, see above ?>
     212                <?php if ( get_background_image() ) { ?>
     213                <img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" /><br />
     214                <img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" />
     215                <?php } ?>
     216        </div>
     217        <?php } ?>
    219218</td>
    220219</tr>
    221220<?php if ( get_background_image() ) : ?>