Add Repeat-x/repeat-y support to Custom Backgrounds, Add Live preview of Repeat option, Use Thumbnail of background for Background Preview. Props jshreve. See #12186

git-svn-id: https://develop.svn.wordpress.org/trunk@13856 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse
2010-03-28 02:53:04 +00:00
parent da2927d104
commit d3eec153be
5 changed files with 59 additions and 37 deletions

View File

@@ -1451,20 +1451,32 @@ function _custom_background_cb() {
if ( !$background && !$color )
return;
$repeat = get_theme_mod('background_repeat', 'repeat');
if ( 'no-repeat' == $repeat )
$repeat = 'background-repeat: no-repeat;';
else
$repeat = 'background-repeat: repeat;';
$position = get_theme_mod('background_position', 'left');
if ( 'center' == $position )
$position = 'background-position: top center;';
elseif ( 'right' == $position )
$position = 'background-position: top right;';
else
$position = 'background-position: top left;';
$attachment = get_theme_mod('background_attachment', 'fixed');
if ( 'scroll' == $attachment )
switch ( get_theme_mod('background_repeat', 'repeat') ) {
case 'no-repeat':
$repeat = 'background-repeat: no-repeat;';
break;
case 'repeat-x':
$repeat = 'background-repeat: repeat-x;';
break;
case 'repeat-y':
$repeat = 'background-repeat: repeat-y;';
break;
default:
$repeat = 'background-repeat: repeat;';
}
switch ( get_theme_mod('background_position', 'left') ) {
case 'center':
$position = 'background-position: top center;';
break;
case 'right':
$position = 'background-position: top right;';
break;
default:
$position = 'background-position: top left;';
}
if ( 'scroll' == get_theme_mod('background_attachment', 'fixed') )
$attachment = 'background-attachment: scroll;';
else
$attachment = 'background-attachment: fixed;';
@@ -1474,11 +1486,6 @@ function _custom_background_cb() {
else
$image = '';
if ( !empty($background ) )
$image = "background-image: url('$background');";
else
$image = '';
if ( !empty($color) )
$color = "background-color: #$color;";
else