2012-08-03 00:10:03 +02:00
|
|
|
/**
|
|
|
|
* Theme Customizer enhancements for a better user experience.
|
|
|
|
*
|
|
|
|
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
|
2012-08-28 04:18:43 +02:00
|
|
|
* Things like site title, description, and background color changes.
|
2012-08-03 00:10:03 +02:00
|
|
|
*
|
2012-08-28 04:18:43 +02:00
|
|
|
* See related settings in twentytwelve_customize_preview_js()
|
2012-08-03 00:10:03 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
( function( $ ) {
|
|
|
|
// Site title and description.
|
|
|
|
wp.customize( 'blogname', function( value ) {
|
|
|
|
value.bind( function( to ) {
|
|
|
|
$( '.site-title a' ).html( to );
|
|
|
|
} );
|
|
|
|
} );
|
|
|
|
wp.customize( 'blogdescription', function( value ) {
|
|
|
|
value.bind( function( to ) {
|
|
|
|
$( '.site-description' ).html( to );
|
|
|
|
} );
|
|
|
|
} );
|
|
|
|
|
2012-07-25 21:42:55 +02:00
|
|
|
// Hook into background color change and adjust body class value as needed.
|
|
|
|
wp.customize( 'background_color', function( value ) {
|
|
|
|
value.bind( function( to ) {
|
|
|
|
if ( '#ffffff' == to || '#fff' == to || '' == to )
|
2012-08-25 19:47:34 +02:00
|
|
|
$( 'body' ).addClass( 'custom-background-white' );
|
2012-07-25 21:42:55 +02:00
|
|
|
else if ( '' == to )
|
2012-08-25 19:47:34 +02:00
|
|
|
$( 'body' ).addClass( 'custom-background-empty' );
|
2012-07-25 21:42:55 +02:00
|
|
|
else
|
2012-08-25 19:47:34 +02:00
|
|
|
$( 'body' ).removeClass( 'custom-background-empty custom-background-white' );
|
2012-07-25 21:42:55 +02:00
|
|
|
} );
|
|
|
|
} );
|
|
|
|
} )( jQuery );
|