customizer.php 1.0 KB

123456789101112131415161718192021222324252627
  1. <?php
  2. /**
  3. * Dyad Theme Customizer
  4. *
  5. * @package Dyad
  6. */
  7. /**
  8. * Add postMessage support for site title and description for the Theme Customizer.
  9. *
  10. * @param WP_Customize_Manager $wp_customize Theme Customizer object.
  11. */
  12. function dyad_2_customize_register( $wp_customize ) {
  13. $wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
  14. $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
  15. $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
  16. $wp_customize->get_control( 'display_header_text' )->label = __( 'Display Site Title', 'dyad-2' );
  17. }
  18. add_action( 'customize_register', 'dyad_2_customize_register' );
  19. /**
  20. * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
  21. */
  22. function dyad_2_customize_preview_js() {
  23. wp_enqueue_script( 'dyad_2_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20130508', true );
  24. }
  25. add_action( 'customize_preview_init', 'dyad_2_customize_preview_js' );