customizer.php 1022 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * Rebalance Theme Customizer.
  4. *
  5. * @package Rebalance
  6. */
  7. /**
  8. * Implement Customizer additions and adjustments.
  9. *
  10. * @since Rebalance 1.0
  11. *
  12. * @param WP_Customize_Manager $wp_customize Customizer object.
  13. */
  14. function rebalance_customize_register( $wp_customize ) {
  15. // Add postMessage support for site title and description.
  16. $wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
  17. $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
  18. $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
  19. }
  20. add_action( 'customize_register', 'rebalance_customize_register' );
  21. /**
  22. * Bind JS handlers to make Theme Customizer preview reload changes asynchronously.
  23. *
  24. * @since Rebalance 1.0
  25. */
  26. function rebalance_customize_preview_js() {
  27. wp_enqueue_script( 'rebalance_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20131205', true );
  28. }
  29. add_action( 'customize_preview_init', 'rebalance_customize_preview_js' );