Add defaults for background option radios. see #12186
git-svn-id: http://svn.automattic.com/wordpress/trunk@13189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
447b0a50da
commit
f35b2128ae
|
@ -172,37 +172,37 @@ if ( $this->admin_image_div_callback ) {
|
||||||
<tr>
|
<tr>
|
||||||
<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Position' ); ?></span></legend>
|
<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Position' ); ?></span></legend>
|
||||||
<label>
|
<label>
|
||||||
<input name="background-position" type="radio" value="left" <?php checked('left', get_theme_mod('background_position')); ?> />
|
<input name="background-position" type="radio" value="left" <?php checked('left', get_theme_mod('background_position', 'left')); ?> />
|
||||||
<?php _e('Left') ?>
|
<?php _e('Left') ?>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input name="background-position" type="radio" value="center" <?php checked('center', get_theme_mod('background_position')); ?> />
|
<input name="background-position" type="radio" value="center" <?php checked('center', get_theme_mod('background_position', 'left')); ?> />
|
||||||
<?php _e('Center') ?>
|
<?php _e('Center') ?>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input name="background-position" type="radio" value="right" <?php checked('right', get_theme_mod('background_position')); ?> />
|
<input name="background-position" type="radio" value="right" <?php checked('right', get_theme_mod('background_position', 'left')); ?> />
|
||||||
<?php _e('Right') ?>
|
<?php _e('Right') ?>
|
||||||
</label>
|
</label>
|
||||||
</fieldset></td>
|
</fieldset></td>
|
||||||
|
|
||||||
<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Repeat' ); ?></span></legend>
|
<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Repeat' ); ?></span></legend>
|
||||||
<label>
|
<label>
|
||||||
<input name="background-repeat" type="radio" value="no-repeat" <?php checked('no-repeat', get_theme_mod('background_repeat')); ?> />
|
<input name="background-repeat" type="radio" value="no-repeat" <?php checked('no-repeat', get_theme_mod('background_repeat', 'repeat')); ?> />
|
||||||
<?php _e('No repeat') ?>
|
<?php _e('No repeat') ?>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input name="background-repeat" type="radio" value="repeat" <?php checked('repeat', get_theme_mod('background_repeat')); ?> />
|
<input name="background-repeat" type="radio" value="repeat" <?php checked('repeat', get_theme_mod('background_repeat', 'repeat')); ?> />
|
||||||
<?php _e('Tile') ?>
|
<?php _e('Tile') ?>
|
||||||
</label>
|
</label>
|
||||||
</fieldset></td>
|
</fieldset></td>
|
||||||
|
|
||||||
<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Attachment' ); ?></span></legend>
|
<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Attachment' ); ?></span></legend>
|
||||||
<label>
|
<label>
|
||||||
<input name="background-attachment" type="radio" value="scroll" <?php checked('scroll', get_theme_mod('background_attachment')); ?> />
|
<input name="background-attachment" type="radio" value="scroll" <?php checked('scroll', get_theme_mod('background_attachment', 'fixed')); ?> />
|
||||||
<?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')); ?> />
|
<input name="background-attachment" type="radio" value="fixed" <?php checked('fixed', get_theme_mod('background_attachment', 'fixed')); ?> />
|
||||||
<?php _e('Fixed') ?>
|
<?php _e('Fixed') ?>
|
||||||
</label>
|
</label>
|
||||||
</fieldset></td>
|
</fieldset></td>
|
||||||
|
|
|
@ -1372,6 +1372,9 @@ function background_image() {
|
||||||
* @param callback $admin_image_div_callback Output a custom background image div on the custom background administration screen. Optional.
|
* @param callback $admin_image_div_callback Output a custom background image div on the custom background administration screen. Optional.
|
||||||
*/
|
*/
|
||||||
function add_custom_background($header_callback = '', $admin_header_callback = '', $admin_image_div_callback = '') {
|
function add_custom_background($header_callback = '', $admin_header_callback = '', $admin_image_div_callback = '') {
|
||||||
|
if ( isset($GLOBALS['custom_background']) )
|
||||||
|
return;
|
||||||
|
|
||||||
if ( empty($header_callback) )
|
if ( empty($header_callback) )
|
||||||
$header_callback = '_custom_background_cb';
|
$header_callback = '_custom_background_cb';
|
||||||
|
|
||||||
|
@ -1397,19 +1400,19 @@ function _custom_background_cb() {
|
||||||
if ( !$background )
|
if ( !$background )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$repeat = get_theme_mod('background_repeat');
|
$repeat = get_theme_mod('background_repeat', 'repeat');
|
||||||
if ( 'no-repeat' == $repeat )
|
if ( 'no-repeat' == $repeat )
|
||||||
$repeat = 'background-repeat: no-repeat;';
|
$repeat = 'background-repeat: no-repeat;';
|
||||||
else
|
else
|
||||||
$repeat = 'background-repeat: repeat;';
|
$repeat = 'background-repeat: repeat;';
|
||||||
$position = get_theme_mod('background_position');
|
$position = get_theme_mod('background_position', 'left');
|
||||||
if ( 'center' == $position )
|
if ( 'center' == $position )
|
||||||
$position = 'background-position-x: center;';
|
$position = 'background-position-x: center;';
|
||||||
elseif ( 'right' == $position )
|
elseif ( 'right' == $position )
|
||||||
$position = 'background-position-x: right;';
|
$position = 'background-position-x: right;';
|
||||||
else
|
else
|
||||||
$position = 'background-position-x: left;';
|
$position = 'background-position-x: left;';
|
||||||
$attachment = get_theme_mod('background_attachment');
|
$attachment = get_theme_mod('background_attachment', 'fixed');
|
||||||
if ( 'scroll' == $attachment )
|
if ( 'scroll' == $attachment )
|
||||||
$attachment = 'background-attachment: scroll;';
|
$attachment = 'background-attachment: scroll;';
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue