Skip to content

Commit

Permalink
Theme Customizer: Remove background_image_thumb when saving settings.…
Browse files Browse the repository at this point in the history
… fixes #20871.

This prevents the background_image and background_image_thumb settings from getting out of sync.
In 3.5 we can consider using background-size on Appearance > Background, eliminating _thumb.



git-svn-id: http://core.svn.wordpress.org/trunk@21053 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
nacin committed Jun 11, 2012
1 parent 7c21462 commit 2d07cd3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions wp-includes/class-wp-customize-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,10 @@ public function register_controls() {
'theme_supports' => 'custom-background',
) );

$this->add_setting( new WP_Customize_Background_Image_Setting( $this, 'background_image_thumb', array(
'theme_supports' => 'custom-background',
) ) );

$this->add_control( new WP_Customize_Background_Image_Control( $this ) );

$this->add_setting( 'background_repeat', array(
Expand Down
12 changes: 10 additions & 2 deletions wp-includes/class-wp-customize-setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ public function update() {}
*
* Results should be properly handled using another setting or callback.
*/
class WP_Customize_Header_Image_Setting extends WP_Customize_Setting {
final class WP_Customize_Header_Image_Setting extends WP_Customize_Setting {
public $id = 'header_image_data';

public function update( $value ) {
Expand All @@ -398,4 +398,12 @@ public function update( $value ) {
else
$custom_image_header->set_header_image( $value );
}
}
}

final class WP_Customize_Background_Image_Setting extends WP_Customize_Setting {
public $id = 'background_image_thumb';

public function update( $value ) {
remove_theme_mod( 'background_image_thumb' );
}
}

0 comments on commit 2d07cd3

Please sign in to comment.