2012-08-02 18:10:03 -04:00
|
|
|
/**
|
|
|
|
* Theme Customizer enhancements for a better user experience.
|
|
|
|
*
|
|
|
|
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
|
2012-08-27 22:18:43 -04:00
|
|
|
* Things like site title, description, and background color changes.
|
2012-08-02 18:10:03 -04: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 15:42:55 -04: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 13:47:34 -04:00
|
|
|
$( 'body' ).addClass( 'custom-background-white' );
|
2012-07-25 15:42:55 -04:00
|
|
|
else if ( '' == to )
|
2012-08-25 13:47:34 -04:00
|
|
|
$( 'body' ).addClass( 'custom-background-empty' );
|
2012-07-25 15:42:55 -04:00
|
|
|
else
|
2012-08-25 13:47:34 -04:00
|
|
|
$( 'body' ).removeClass( 'custom-background-empty custom-background-white' );
|
2012-07-25 15:42:55 -04:00
|
|
|
} );
|
|
|
|
} );
|
|
|
|
} )( jQuery );
|