/** * File customizer.js. * * Theme Customizer enhancements for a better user experience. * * Contains handlers to make Theme Customizer preview reload changes asynchronously. */ ( function( $ ) { // Site title and description. wp.customize( 'blogname', function( value ) { value.bind( function( to ) { $( '.logo' ).text( to ); } ); } ); wp.customize( 'blogdescription', function( value ) { value.bind( function( to ) { $( '.tagline' ).text( to ); } ); } ); // Top menu visibility wp.customize( 'calibration_show_menu', function( value ) { value.bind( function( to ) { if( to ) { $( '#nav' ).css('visibility', 'visible'); } else { $( '#nav' ).css('visibility', 'hidden'); } }); }); // Site layout switch wp.customize( 'calibration_site_layout', function( value ) { value.bind( function( to ) { switch(to) { case 'sidebar_l': $( 'body' ).removeClass('has-sidebar-after'); $( 'body' ).removeClass('has-sidebar-below'); $( 'body' ).addClass('has-sidebar-before'); break; case 'sidebar_b': $( 'body' ).removeClass('has-sidebar-after'); $( 'body' ).removeClass('has-sidebar-before'); $( 'body' ).addClass('has-sidebar-below'); break; default: $( 'body' ).removeClass('has-sidebar-before'); $( 'body' ).removeClass('has-sidebar-below'); $( 'body' ).addClass('has-sidebar-after'); } }); }); // Front page layout switch wp.customize( 'calibration_front_layout', function( value ) { value.bind( function( to ) { var site_layout = wp.customize.value( 'calibration_site_layout' )(); var to = ( to == '' ? site_layout : to ); switch(to) { case 'sidebar_l': $( 'body.front' ).removeClass('has-sidebar-after'); $( 'body.front' ).removeClass('has-sidebar-below'); $( 'body.front' ).addClass('has-sidebar-before'); break; case 'sidebar_b': $( 'body.front' ).removeClass('has-sidebar-after'); $( 'body.front' ).removeClass('has-sidebar-before'); $( 'body.front' ).addClass('has-sidebar-below'); break; case 'sidebar_r': $( 'body.front' ).removeClass('has-sidebar-before'); $( 'body.front' ).removeClass('has-sidebar-below'); $( 'body.front' ).addClass('has-sidebar-after'); break; } }); }); // Front page title display wp.customize( 'calibration_show_front_title', function( value ) { value.bind( function( to ) { if( to ) { $( '.home h1.entry-title' ).show(); } else { $( '.home h1.entry-title' ).hide(); } }); }); // Footer title and entry wp.customize( 'calibration_footer_title', function( value ) { value.bind( function( to ) { $( '.footer-title' ).text( to ); } ); } ); wp.customize( 'calibration_footer_entry', function( value ) { value.bind( function( to ) { $( '.footer-entry' ).text( to ); } ); } ); // Footer privacy policy link wp.customize( 'calibration_show_privacy_policy', function( value ) { value.bind( function( to ) { if( to ) { $( '#footer .privacy-policy-link' ).show(); } else { $( '#footer .privacy-policy-link' ).hide(); } }); }); } )( jQuery );