diff --git a/wp-admin/custom-background.php b/wp-admin/custom-background.php index 1e0a0f1b44..d024c9a4aa 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 { ?> -