diff --git a/wp-admin/custom-background.php b/wp-admin/custom-background.php index 1e0a0f1b4..d024c9a4a 100644 --- a/wp-admin/custom-background.php +++ b/wp-admin/custom-background.php @@ -93,12 +93,29 @@ class Custom_Background { check_admin_referer('custom-background'); remove_theme_mods(); } - if ( isset($_POST['repeat-background']) ) { + if ( isset($_POST['background-repeat']) ) { check_admin_referer('custom-background'); - $repeat = $_POST['repeat-background'] ? true: false; + if ( in_array($_POST['background-repeat'], array('repeat', 'no-repeat')) ) + $repeat = $_POST['background-repeat']; + else + $repeat = 'repeat'; set_theme_mod('background_repeat', $repeat); - } elseif ( isset($_POST['save-background-options']) ) { - set_theme_mod('background_repeat', false); + } + if ( isset($_POST['background-position']) ) { + check_admin_referer('custom-background'); + if ( in_array($_POST['background-position'], array('center', 'right', 'left')) ) + $position = $_POST['background-position']; + else + $position = 'left'; + set_theme_mod('background_position', $position); + } + if ( isset($_POST['background-attachment']) ) { + check_admin_referer('custom-background'); + if ( in_array($_POST['background-attachment'], array('fixed', 'scroll')) ) + $attachment = $_POST['background-attachment']; + else + $attachment = 'fixed'; + set_theme_mod('background_attachment', $attachment); } if ( isset($_POST['remove-background']) ) { check_admin_referer('custom-background'); @@ -132,14 +149,75 @@ if ( $this->admin_image_div_callback ) { call_user_func($this->admin_image_div_callback); } else { ?> -
- +
+
-
-

+ +
+ +

+
+ + + + + + + + + + + + + + + + + +
+ + + +
+ + +
+ + +
+ + + +
+
+ + +
+


@@ -148,34 +226,9 @@ if ( $this->admin_image_div_callback ) {

-
-
- -

-
-
- - -
-

-

-
- - -
-
- +

diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 7ec46af4b..75551640a 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -1398,11 +1398,29 @@ function _custom_background_cb() { return; $repeat = get_theme_mod('background_repeat'); - $repeat = $repeat ? '' : ' no-repeat'; + if ( 'no-repeat' == $repeat ) + $repeat = 'background-repeat: no-repeat;'; + else + $repeat = 'background-repeat: repeat;'; + $position = get_theme_mod('background_position'); + if ( 'center' == $position ) + $position = 'background-position: center;'; + elseif ( 'right' == $position ) + $position = 'background-position: right;'; + else + $position = 'background-position: left;'; + $attachment = get_theme_mod('background_attachment'); + if ( 'scroll' == $attachment ) + $attachment = 'background-attachment: scroll;'; + else + $attachment = 'background-attachment: fixed;'; ?>