customize-preview-wpcom.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * File customize-preview-wpcom.js.
  3. *
  4. * Instantly live-update customizer settings in the preview for improved user experience,
  5. * targeting the updates needed to hide the page title on the homepage on WordPress.com.
  6. */
  7. ( function( $ ) {
  8. // Hide Front Page Title
  9. wp.customize( 'hide_front_page_title', function( value ) {
  10. value.bind( function( to ) {
  11. if ( true === to ) {
  12. $( 'body' ).addClass( 'hide-homepage-title' );
  13. } else {
  14. $( 'body' ).removeClass( 'hide-homepage-title' );
  15. }
  16. } );
  17. } );
  18. // Hide Site Header
  19. wp.customize( 'hide_site_header', function( value ) {
  20. value.bind( function( to ) {
  21. if ( true === to ) {
  22. $( 'body' ).addClass( 'hide-homepage-header' );
  23. } else {
  24. $( 'body' ).removeClass( 'hide-homepage-header' );
  25. }
  26. } );
  27. } );
  28. // Hide Site Footer Menu
  29. wp.customize( 'hide_site_footer', function( value ) {
  30. value.bind( function( to ) {
  31. if ( true === to ) {
  32. $( 'body' ).addClass( 'hide-homepage-footer' );
  33. } else {
  34. $( 'body' ).removeClass( 'hide-homepage-footer' );
  35. }
  36. } );
  37. } );
  38. } )( jQuery );