Make WordPress Core

Changeset 26878


Ignore:
Timestamp:
12/29/2013 08:05:50 AM (13 years ago)
Author:
SergeyBiryukov
Message:

Always show Background Image section heading and the opening table tag on Custom Background screen, to make in consistent with Custom Header and avoid broken markup.

props obenland.
fixes #26731.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

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

    r26594 r26878  
    180180?>
    181181<div class="wrap" id="custom-background">
    182 <h2><?php _e('Custom Background'); ?></h2>
    183 <?php if ( !empty($this->updated) ) { ?>
     182<h2><?php _e( 'Custom Background' ); ?></h2>
     183
     184<?php if ( ! empty( $this->updated ) ) { ?>
    184185<div id="message" class="updated">
    185186<p><?php printf( __( 'Background updated. <a href="%s">Visit your site</a> to see how it looks.' ), home_url( '/' ) ); ?></p>
    186187</div>
    187 <?php }
    188 
    189         if ( $this->admin_image_div_callback ) {
    190                 call_user_func($this->admin_image_div_callback);
    191         } else {
    192 ?>
    193 <h3><?php _e('Background Image'); ?></h3>
     188<?php } ?>
     189
     190<h3><?php _e( 'Background Image' ); ?></h3>
     191
    194192<table class="form-table">
    195193<tbody>
    196194<tr valign="top">
    197 <th scope="row"><?php _e('Preview'); ?></th>
     195<th scope="row"><?php _e( 'Preview' ); ?></th>
    198196<td>
    199 <?php
    200 $background_styles = '';
    201 if ( $bgcolor = get_background_color() )
    202         $background_styles .= 'background-color: #' . $bgcolor . ';';
    203 
    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 } ?>
     197        <?php
     198        if ( $this->admin_image_div_callback ) {
     199                call_user_func( $this->admin_image_div_callback );
     200        } else {
     201                $background_styles = '';
     202                if ( $bgcolor = get_background_color() )
     203                        $background_styles .= 'background-color: #' . $bgcolor . ';';
     204
     205                if ( get_background_image() ) {
     206                        $background_image_thumb = esc_url( set_url_scheme( get_theme_mod( 'background_image_thumb', str_replace( '%', '%%', get_background_image() ) ) ) );
     207                        // background-image URL must be single quote, see below
     208                        $background_styles .= ' background-image: url(\'' . $background_image_thumb . '\');'
     209                                . ' background-repeat: ' . get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) . ';'
     210                                . ' background-position: top ' . get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
     211                }
     212        ?>
     213        <div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // must be double quote, see above ?>
     214                <?php if ( get_background_image() ) { ?>
     215                <img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" /><br />
     216                <img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" />
     217                <?php } ?>
     218        </div>
     219        <?php } ?>
    219220</td>
    220221</tr>
     222
    221223<?php if ( get_background_image() ) : ?>
    222224<tr valign="top">
    … …  
    244246</td>
    245247</tr>
    246 
    247248<?php endif; ?>
     249
    248250<tr valign="top">
    249251<th scope="row"><?php _e('Select Image'); ?></th>
  • trunk/src/wp-admin/custom-header.php

    r26868 r26878  
    451451
    452452<div class="wrap">
    453 <h2><?php _e('Custom Header'); ?></h2>
     453<h2><?php _e( 'Custom Header' ); ?></h2>
    454454
    455455<?php if ( ! empty( $this->updated ) ) { ?>
    … …  
    468468<th scope="row"><?php _e( 'Preview' ); ?></th>
    469469<td>
    470         <?php if ( $this->admin_image_div_callback ) {
    471           call_user_func( $this->admin_image_div_callback );
     470        <?php
     471        if ( $this->admin_image_div_callback ) {
     472                call_user_func( $this->admin_image_div_callback );
    472473        } else {
    473474                $custom_header = get_custom_header();
Note: See TracChangeset for help on using the changeset viewer.