customize-controls.js 710 B

123456789101112131415161718192021222324252627282930
  1. /**
  2. * File customizer.js.
  3. *
  4. * Theme Customizer enhancements for a better user experience.
  5. *
  6. * Contains handlers to make Theme Customizer preview reload changes asynchronously.
  7. */
  8. (function() {
  9. wp.customize.bind( 'ready', function() {
  10. // Only show the color hue control when there's a custom primary color.
  11. wp.customize( 'primary_color', function( setting ) {
  12. wp.customize.control( 'primary_color_hue', function( control ) {
  13. var visibility = function() {
  14. if ( 'custom' === setting.get() ) {
  15. control.container.slideDown( 180 );
  16. } else {
  17. control.container.slideUp( 180 );
  18. }
  19. };
  20. visibility();
  21. setting.bind( visibility );
  22. });
  23. });
  24. });
  25. })( jQuery );