Theme Customizer: Ensure background_color and background_image exist instead of blindly attempting to access their controls. see #19910.

git-svn-id: http://svn.automattic.com/wordpress/trunk@20259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
koopersmith 2012-03-22 07:03:44 +00:00
parent 452da8fccc
commit 7a794b8941
2 changed files with 10 additions and 5 deletions

View File

@ -249,10 +249,13 @@
});
// Background color uses postMessage by default
api('background_color').method = 'postMessage';
api( 'background_color', function( control ) {
control.method = 'postMessage';
});
// api('background_image').method = 'postMessage';
api('background_image').uploader.param( 'post_data[context]', 'custom-background' );
api( 'background_image', function( control ) {
control.uploader.param( 'post_data[context]', 'custom-background' );
});
});
})( wp, jQuery );

View File

@ -68,8 +68,10 @@
body = $(document.body);
// Auto update background color by default
api.bind( 'background_color', function( to ) {
body.css( 'background-color', '#' + to );
api( 'background_color', function( value ) {
value.bind( function( to ) {
body.css( 'background-color', '#' + to );
});
});
});