WordPress.org

Make WordPress Core

Ticket #20816: 20816.diff

File 20816.diff, 7.0 KB (added by obenland, 6 years ago)
  • wp-admin/custom-background.php

     
    212212if ( get_background_image() ) {
    213213        // background-image URL must be single quote, see below
    214214        $background_styles .= ' background-image: url(\'' . set_url_scheme( get_theme_mod( 'background_image_thumb', get_background_image() ) ) . '\');'
    215                 . ' background-repeat: ' . get_theme_mod('background_repeat', 'repeat') . ';'
    216                 . ' background-position: top ' . get_theme_mod('background_position_x', 'left');
     215                . ' background-repeat: ' . get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'background-repeat' ) ) . ';'
     216                . ' background-position: top ' . get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'background-position' ) );
    217217}
    218218?>
    219219<div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // must be double quote, see above ?>
     
    286286<th scope="row"><?php _e( 'Position' ); ?></th>
    287287<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Position' ); ?></span></legend>
    288288<label>
    289 <input name="background-position-x" type="radio" value="left"<?php checked('left', get_theme_mod('background_position_x', 'left')); ?> />
     289<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' ) ) ); ?> />
    290290<?php _e('Left') ?>
    291291</label>
    292292<label>
    293 <input name="background-position-x" type="radio" value="center"<?php checked('center', get_theme_mod('background_position_x', 'left')); ?> />
     293<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' ) ) ); ?> />
    294294<?php _e('Center') ?>
    295295</label>
    296296<label>
    297 <input name="background-position-x" type="radio" value="right"<?php checked('right', get_theme_mod('background_position_x', 'left')); ?> />
     297<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' ) ) ); ?> />
    298298<?php _e('Right') ?>
    299299</label>
    300300</fieldset></td>
     
    303303<tr valign="top">
    304304<th scope="row"><?php _e( 'Repeat' ); ?></th>
    305305<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Repeat' ); ?></span></legend>
    306 <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>
    307         <label><input type="radio" name="background-repeat" value="repeat"<?php checked('repeat', get_theme_mod('background_repeat', 'repeat')); ?> /> <?php _e('Tile'); ?></label>
    308         <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>
    309         <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>
     306<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>
     307        <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>
     308        <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>
     309        <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>
    310310</fieldset></td>
    311311</tr>
    312312
     
    314314<th scope="row"><?php _e( 'Attachment' ); ?></th>
    315315<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Attachment' ); ?></span></legend>
    316316<label>
    317 <input name="background-attachment" type="radio" value="scroll" <?php checked('scroll', get_theme_mod('background_attachment', 'scroll')); ?> />
     317<input name="background-attachment" type="radio" value="scroll" <?php checked( 'scroll', get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'background-attachment' ) ) ); ?> />
    318318<?php _e('Scroll') ?>
    319319</label>
    320320<label>
    321 <input name="background-attachment" type="radio" value="fixed" <?php checked('fixed', get_theme_mod('background_attachment', 'scroll')); ?> />
     321<input name="background-attachment" type="radio" value="fixed" <?php checked( 'fixed', get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'background-attachment' ) ) ); ?> />
    322322<?php _e('Fixed') ?>
    323323</label>
    324324</fieldset></td>
  • wp-includes/theme.php

     
    11341134        if ( $background ) {
    11351135                $image = " background-image: url('$background');";
    11361136
    1137                 $repeat = get_theme_mod( 'background_repeat', 'repeat' );
     1137                $repeat = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'background-repeat' ) );
    11381138                if ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) )
    11391139                        $repeat = 'repeat';
    11401140                $repeat = " background-repeat: $repeat;";
    11411141
    1142                 $position = get_theme_mod( 'background_position_x', 'left' );
     1142                $position = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'background-position' ) );
    11431143                if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) )
    11441144                        $position = 'left';
    11451145                $position = " background-position: top $position;";
    11461146
    1147                 $attachment = get_theme_mod( 'background_attachment', 'scroll' );
     1147                $attachment = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'background-attachment' ) );
    11481148                if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) )
    11491149                        $attachment = 'scroll';
    11501150                $attachment = " background-attachment: $attachment;";
     
    13221322                                $args = array( 0 => array() );
    13231323
    13241324                        $defaults = array(
    1325                                 'default-image' => '',
    1326                                 'default-color' => '',
    1327                                 'wp-head-callback' => '_custom_background_cb',
    1328                                 'admin-head-callback' => '',
     1325                                'default-image'          => '',
     1326                                'background-repeat'      => 'repeat',
     1327                                'background-position'    => 'left',
     1328                                'background-attachment'  => 'scroll',
     1329                                'default-color'          => '',
     1330                                'wp-head-callback'       => '_custom_background_cb',
     1331                                'admin-head-callback'    => '',
    13291332                                'admin-preview-callback' => '',
    13301333                        );
    13311334