WordPress.org

Make WordPress Core

Ticket #20816: 20816.1.diff

File 20816.1.diff, 7.1 KB (added by obenland, 18 months ago)
  • wp-admin/custom-background.php

     
    206206        $background_image_thumb = esc_url( set_url_scheme( get_theme_mod( 'background_image_thumb', str_replace( '%', '%%', get_background_image() ) ) ) ); 
    207207        // background-image URL must be single quote, see below 
    208208        $background_styles .= ' background-image: url(\'' . $background_image_thumb . '\');' 
    209                 . ' background-repeat: ' . get_theme_mod('background_repeat', 'repeat') . ';' 
    210                 . ' background-position: top ' . get_theme_mod('background_position_x', 'left'); 
     209                . ' background-repeat: ' . get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'background-repeat' ) ) . ';' 
     210                . ' background-position: top ' . get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'background-position' ) ); 
    211211} 
    212212?> 
    213213<div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // must be double quote, see above ?> 
     
    277277<th scope="row"><?php _e( 'Position' ); ?></th> 
    278278<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Position' ); ?></span></legend> 
    279279<label> 
    280 <input name="background-position-x" type="radio" value="left"<?php checked('left', get_theme_mod('background_position_x', 'left')); ?> /> 
     280<input name="background-position-x" type="radio" value="left"<?php checked( 'left', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'background-position' ) ) ); ?> /> 
    281281<?php _e('Left') ?> 
    282282</label> 
    283283<label> 
    284 <input name="background-position-x" type="radio" value="center"<?php checked('center', get_theme_mod('background_position_x', 'left')); ?> /> 
     284<input name="background-position-x" type="radio" value="center"<?php checked( 'center', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'background-position' ) ) ); ?> /> 
    285285<?php _e('Center') ?> 
    286286</label> 
    287287<label> 
    288 <input name="background-position-x" type="radio" value="right"<?php checked('right', get_theme_mod('background_position_x', 'left')); ?> /> 
     288<input name="background-position-x" type="radio" value="right"<?php checked( 'right', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'background-position' ) ) ); ?> /> 
    289289<?php _e('Right') ?> 
    290290</label> 
    291291</fieldset></td> 
     
    294294<tr valign="top"> 
    295295<th scope="row"><?php _e( 'Repeat' ); ?></th> 
    296296<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Repeat' ); ?></span></legend> 
    297 <label><input type="radio" name="background-repeat" value="no-repeat"<?php checked('no-repeat', get_theme_mod('background_repeat', 'repeat')); ?> /> <?php _e('No Repeat'); ?></label> 
    298         <label><input type="radio" name="background-repeat" value="repeat"<?php checked('repeat', get_theme_mod('background_repeat', 'repeat')); ?> /> <?php _e('Tile'); ?></label> 
    299         <label><input type="radio" name="background-repeat" value="repeat-x"<?php checked('repeat-x', get_theme_mod('background_repeat', 'repeat')); ?> /> <?php _e('Tile Horizontally'); ?></label> 
    300         <label><input type="radio" name="background-repeat" value="repeat-y"<?php checked('repeat-y', get_theme_mod('background_repeat', 'repeat')); ?> /> <?php _e('Tile Vertically'); ?></label> 
     297<label><input type="radio" name="background-repeat" value="no-repeat"<?php checked( 'no-repeat', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'background-repeat' ) ) ); ?> /> <?php _e('No Repeat'); ?></label> 
     298        <label><input type="radio" name="background-repeat" value="repeat"<?php checked( 'repeat', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'background-repeat' ) ) ); ?> /> <?php _e('Tile'); ?></label> 
     299        <label><input type="radio" name="background-repeat" value="repeat-x"<?php checked( 'repeat-x', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'background-repeat' ) ) ); ?> /> <?php _e('Tile Horizontally'); ?></label> 
     300        <label><input type="radio" name="background-repeat" value="repeat-y"<?php checked( 'repeat-y', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'background-repeat' ) ) ); ?> /> <?php _e('Tile Vertically'); ?></label> 
    301301</fieldset></td> 
    302302</tr> 
    303303 
     
    305305<th scope="row"><?php _ex( 'Attachment', 'Background Attachment' ); ?></th> 
    306306<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Attachment' ); ?></span></legend> 
    307307<label> 
    308 <input name="background-attachment" type="radio" value="scroll" <?php checked('scroll', get_theme_mod('background_attachment', 'scroll')); ?> /> 
    309 <?php _e('Scroll') ?> 
     308<input name="background-attachment" type="radio" value="scroll" <?php checked( 'scroll', get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'background-attachment' ) ) ); ?> /> 
     309<?php _e( 'Scroll' ); ?> 
    310310</label> 
    311311<label> 
    312 <input name="background-attachment" type="radio" value="fixed" <?php checked('fixed', get_theme_mod('background_attachment', 'scroll')); ?> /> 
    313 <?php _e('Fixed') ?> 
     312<input name="background-attachment" type="radio" value="fixed" <?php checked( 'fixed', get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'background-attachment' ) ) ); ?> /> 
     313<?php _e( 'Fixed' ); ?> 
    314314</label> 
    315315</fieldset></td> 
    316316</tr> 
  • wp-includes/theme.php

     
    11691169        if ( $background ) { 
    11701170                $image = " background-image: url('$background');"; 
    11711171 
    1172                 $repeat = get_theme_mod( 'background_repeat', 'repeat' ); 
     1172                $repeat = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'background-repeat' ) ); 
    11731173                if ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) ) 
    11741174                        $repeat = 'repeat'; 
    11751175                $repeat = " background-repeat: $repeat;"; 
    11761176 
    1177                 $position = get_theme_mod( 'background_position_x', 'left' ); 
     1177                $position = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'background-position' ) ); 
    11781178                if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) ) 
    11791179                        $position = 'left'; 
    11801180                $position = " background-position: top $position;"; 
    11811181 
    1182                 $attachment = get_theme_mod( 'background_attachment', 'scroll' ); 
     1182                $attachment = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'background-attachment' ) ); 
    11831183                if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) ) 
    11841184                        $attachment = 'scroll'; 
    11851185                $attachment = " background-attachment: $attachment;"; 
     
    13571357                                $args = array( 0 => array() ); 
    13581358 
    13591359                        $defaults = array( 
    1360                                 'default-image' => '', 
    1361                                 'default-color' => '', 
    1362                                 'wp-head-callback' => '_custom_background_cb', 
    1363                                 'admin-head-callback' => '', 
     1360                                'default-image'          => '', 
     1361                                'background-repeat'      => 'repeat', 
     1362                                'background-position'    => 'left', 
     1363                                'background-attachment'  => 'scroll', 
     1364                                'default-color'          => '', 
     1365                                'wp-head-callback'       => '_custom_background_cb', 
     1366                                'admin-head-callback'    => '', 
    13641367                                'admin-preview-callback' => '', 
    13651368                        ); 
    13661369