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 ) {
|
2013-02-15 11:53:58 -05:00
|
|
|
$( '.site-title a' ).text( to );
|
2012-08-02 18:10:03 -04:00
|
|
|
} );
|
|
|
|
} );
|
|
|
|
wp.customize( 'blogdescription', function( value ) {
|
|
|
|
value.bind( function( to ) {
|
2013-02-15 11:53:58 -05:00
|
|
|
$( '.site-description' ).text( to );
|
2012-08-02 18:10:03 -04:00
|
|
|
} );
|
|
|
|
} );
|
|
|
|
|
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 ) {
|
2012-10-10 16:47:07 -04:00
|
|
|
if ( '#ffffff' == to || '#fff' == 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 );
|