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
|
|
|
*/
|
|
|
|
|
|
|
|
( 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 ) {
|
2012-10-10 22:47:07 +02:00
|
|
|
if ( '#ffffff' == to || '#fff' == 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 );
|