Rename the new custom-background arguments passed to add_theme_support().
* background-position becomes default-position-x * background-attachment becomes default-attachment * background-repeat becomes default-repeat These are in line with existing default-image and default-color arguments, and also makes the position argument unambiguous and forwards compatible. fixes #20816. Built from https://develop.svn.wordpress.org/trunk@26594 git-svn-id: http://core.svn.wordpress.org/trunk@26484 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
26a22db98e
commit
9be4bd5720
|
@ -205,8 +205,8 @@ if ( get_background_image() ) {
|
||||||
$background_image_thumb = esc_url( set_url_scheme( get_theme_mod( 'background_image_thumb', str_replace( '%', '%%', get_background_image() ) ) ) );
|
$background_image_thumb = esc_url( set_url_scheme( get_theme_mod( 'background_image_thumb', str_replace( '%', '%%', get_background_image() ) ) ) );
|
||||||
// background-image URL must be single quote, see below
|
// background-image URL must be single quote, see below
|
||||||
$background_styles .= ' background-image: url(\'' . $background_image_thumb . '\');'
|
$background_styles .= ' background-image: url(\'' . $background_image_thumb . '\');'
|
||||||
. ' background-repeat: ' . get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'background-repeat' ) ) . ';'
|
. ' background-repeat: ' . get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) . ';'
|
||||||
. ' background-position: top ' . get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'background-position' ) );
|
. ' background-position: top ' . get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // must be double quote, see above ?>
|
<div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // must be double quote, see above ?>
|
||||||
|
@ -276,15 +276,15 @@ if ( get_background_image() ) {
|
||||||
<th scope="row"><?php _e( 'Position' ); ?></th>
|
<th scope="row"><?php _e( 'Position' ); ?></th>
|
||||||
<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Position' ); ?></span></legend>
|
<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Position' ); ?></span></legend>
|
||||||
<label>
|
<label>
|
||||||
<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' ) ) ); ?> />
|
<input name="background-position-x" type="radio" value="left"<?php checked( 'left', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ) ); ?> />
|
||||||
<?php _e('Left') ?>
|
<?php _e('Left') ?>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<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' ) ) ); ?> />
|
<input name="background-position-x" type="radio" value="center"<?php checked( 'center', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ) ); ?> />
|
||||||
<?php _e('Center') ?>
|
<?php _e('Center') ?>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<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' ) ) ); ?> />
|
<input name="background-position-x" type="radio" value="right"<?php checked( 'right', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ) ); ?> />
|
||||||
<?php _e('Right') ?>
|
<?php _e('Right') ?>
|
||||||
</label>
|
</label>
|
||||||
</fieldset></td>
|
</fieldset></td>
|
||||||
|
@ -293,10 +293,10 @@ if ( get_background_image() ) {
|
||||||
<tr valign="top">
|
<tr valign="top">
|
||||||
<th scope="row"><?php _e( 'Repeat' ); ?></th>
|
<th scope="row"><?php _e( 'Repeat' ); ?></th>
|
||||||
<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Repeat' ); ?></span></legend>
|
<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Repeat' ); ?></span></legend>
|
||||||
<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>
|
<label><input type="radio" name="background-repeat" value="no-repeat"<?php checked( 'no-repeat', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('No Repeat'); ?></label>
|
||||||
<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>
|
<label><input type="radio" name="background-repeat" value="repeat"<?php checked( 'repeat', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('Tile'); ?></label>
|
||||||
<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>
|
<label><input type="radio" name="background-repeat" value="repeat-x"<?php checked( 'repeat-x', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('Tile Horizontally'); ?></label>
|
||||||
<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>
|
<label><input type="radio" name="background-repeat" value="repeat-y"<?php checked( 'repeat-y', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('Tile Vertically'); ?></label>
|
||||||
</fieldset></td>
|
</fieldset></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
@ -304,11 +304,11 @@ if ( get_background_image() ) {
|
||||||
<th scope="row"><?php _ex( 'Attachment', 'Background Attachment' ); ?></th>
|
<th scope="row"><?php _ex( 'Attachment', 'Background Attachment' ); ?></th>
|
||||||
<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Attachment' ); ?></span></legend>
|
<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Attachment' ); ?></span></legend>
|
||||||
<label>
|
<label>
|
||||||
<input name="background-attachment" type="radio" value="scroll" <?php checked( 'scroll', get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'background-attachment' ) ) ); ?> />
|
<input name="background-attachment" type="radio" value="scroll" <?php checked( 'scroll', get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) ) ); ?> />
|
||||||
<?php _e( 'Scroll' ); ?>
|
<?php _e( 'Scroll' ); ?>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input name="background-attachment" type="radio" value="fixed" <?php checked( 'fixed', get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'background-attachment' ) ) ); ?> />
|
<input name="background-attachment" type="radio" value="fixed" <?php checked( 'fixed', get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) ) ); ?> />
|
||||||
<?php _e( 'Fixed' ); ?>
|
<?php _e( 'Fixed' ); ?>
|
||||||
</label>
|
</label>
|
||||||
</fieldset></td>
|
</fieldset></td>
|
||||||
|
|
|
@ -1280,17 +1280,17 @@ function _custom_background_cb() {
|
||||||
if ( $background ) {
|
if ( $background ) {
|
||||||
$image = " background-image: url('$background');";
|
$image = " background-image: url('$background');";
|
||||||
|
|
||||||
$repeat = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'background-repeat' ) );
|
$repeat = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) );
|
||||||
if ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) )
|
if ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) )
|
||||||
$repeat = 'repeat';
|
$repeat = 'repeat';
|
||||||
$repeat = " background-repeat: $repeat;";
|
$repeat = " background-repeat: $repeat;";
|
||||||
|
|
||||||
$position = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'background-position' ) );
|
$position = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
|
||||||
if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) )
|
if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) )
|
||||||
$position = 'left';
|
$position = 'left';
|
||||||
$position = " background-position: top $position;";
|
$position = " background-position: top $position;";
|
||||||
|
|
||||||
$attachment = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'background-attachment' ) );
|
$attachment = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) );
|
||||||
if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) )
|
if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) )
|
||||||
$attachment = 'scroll';
|
$attachment = 'scroll';
|
||||||
$attachment = " background-attachment: $attachment;";
|
$attachment = " background-attachment: $attachment;";
|
||||||
|
@ -1483,9 +1483,9 @@ function add_theme_support( $feature ) {
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'default-image' => '',
|
'default-image' => '',
|
||||||
'background-repeat' => 'repeat',
|
'default-repeat' => 'repeat',
|
||||||
'background-position' => 'left',
|
'default-position-x' => 'left',
|
||||||
'background-attachment' => 'scroll',
|
'default-attachment' => 'scroll',
|
||||||
'default-color' => '',
|
'default-color' => '',
|
||||||
'wp-head-callback' => '_custom_background_cb',
|
'wp-head-callback' => '_custom_background_cb',
|
||||||
'admin-head-callback' => '',
|
'admin-head-callback' => '',
|
||||||
|
|
Loading…
Reference in New Issue