Make WordPress Core


Ignore:
Timestamp:
03/28/2010 02:53:04 AM (15 years ago)
Author:
dd32
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/theme.php

    r13829 r13856  
    14521452        return;
    14531453
    1454     $repeat = get_theme_mod('background_repeat', 'repeat');
    1455     if ( 'no-repeat' == $repeat )
    1456         $repeat = 'background-repeat: no-repeat;';
    1457     else
    1458         $repeat = 'background-repeat: repeat;';
    1459     $position = get_theme_mod('background_position', 'left');
    1460     if  ( 'center' == $position )
    1461         $position = 'background-position: top center;';
    1462     elseif ( 'right' == $position )
    1463         $position = 'background-position: top right;';
    1464     else
    1465         $position = 'background-position: top left;';
    1466     $attachment = get_theme_mod('background_attachment', 'fixed');
    1467     if ( 'scroll' == $attachment )
     1454    switch ( get_theme_mod('background_repeat', 'repeat') ) {
     1455        case 'no-repeat':
     1456            $repeat = 'background-repeat: no-repeat;';
     1457            break;
     1458        case 'repeat-x':
     1459            $repeat = 'background-repeat: repeat-x;';
     1460            break;
     1461        case 'repeat-y':
     1462            $repeat = 'background-repeat: repeat-y;';
     1463            break;
     1464        default:
     1465            $repeat = 'background-repeat: repeat;';
     1466    }
     1467
     1468    switch ( get_theme_mod('background_position', 'left') ) {
     1469        case 'center':
     1470            $position = 'background-position: top center;';
     1471            break;
     1472        case 'right':
     1473            $position = 'background-position: top right;';
     1474            break;
     1475        default:
     1476            $position = 'background-position: top left;';
     1477    }
     1478
     1479    if ( 'scroll' == get_theme_mod('background_attachment', 'fixed') )
    14681480        $attachment = 'background-attachment: scroll;';
    14691481    else
    14701482        $attachment = 'background-attachment: fixed;';
    1471 
    1472     if ( !empty($background ) )
    1473         $image = "background-image: url('$background');";
    1474     else
    1475         $image = '';
    14761483
    14771484    if ( !empty($background ) )
Note: See TracChangeset for help on using the changeset viewer.