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

git-svn-id: https://develop.svn.wordpress.org/trunk@20259 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Daryl Koopersmith 2012-03-22 07:03:44 +00:00
parent b1b507b2a9
commit f561219e0b
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 );
});
});
});