customizer.php 914 B

1234567891011121314151617181920212223242526
  1. <?php
  2. /**
  3. * bml Theme Customizer
  4. *
  5. * @package bml
  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 bml_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. }
  17. add_action( 'customize_register', 'bml_customize_register' );
  18. /**
  19. * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
  20. */
  21. function bml_customize_preview_js() {
  22. wp_enqueue_script( 'bml_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20130508', true );
  23. }
  24. add_action( 'customize_preview_init', 'bml_customize_preview_js' );