1
0

customizer.php 933 B

1234567891011121314151617181920212223242526
  1. <?php
  2. /**
  3. * Akina Theme Customizer.
  4. *
  5. * @package Sakurairo
  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 akina_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', 'akina_customize_register' );
  18. /**
  19. * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
  20. */
  21. function akina_customize_preview_js() {
  22. wp_enqueue_script( 'akina_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20151215', true );
  23. }
  24. add_action( 'customize_preview_init', 'akina_customize_preview_js' );