jetpack_content_options_customize_preview_js

Binds JS handlers to make Theme Customizer preview reload changes asynchronously.

Description

jetpack_content_options_customize_preview_js(); 

Usage

  1. if ( !function_exists( 'jetpack_content_options_customize_preview_js' ) ) { 
  2. require_once '/modules/theme-tools/content-options/customizer.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = jetpack_content_options_customize_preview_js(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/modules/theme-tools/content-options/customizer.php  
  1. function jetpack_content_options_customize_preview_js() { 
  2. $options = get_theme_support( 'jetpack-content-options' ); 
  3. $blog_display = ( ! empty( $options[0]['blog-display'] ) ) ? $options[0]['blog-display'] : null; 
  4. $blog_display = preg_grep( '/^(content|excerpt)$/', (array) $blog_display ); 
  5. sort( $blog_display ); 
  6. $blog_display = implode( ', ', $blog_display ); 
  7. $blog_display = ( 'content, excerpt' === $blog_display ) ? 'mixed' : $blog_display; 
  8. $masonry = ( ! empty( $options[0]['masonry'] ) ) ? $options[0]['masonry'] : null; 
  9. $post_details = ( ! empty( $options[0]['post-details'] ) ) ? $options[0]['post-details'] : null; 
  10. $date = ( ! empty( $post_details['date'] ) ) ? $post_details['date'] : null; 
  11. $categories = ( ! empty( $post_details['categories'] ) ) ? $post_details['categories'] : null; 
  12. $tags = ( ! empty( $post_details['tags'] ) ) ? $post_details['tags'] : null; 
  13. $author = ( ! empty( $post_details['author'] ) ) ? $post_details['author'] : null; 
  14.  
  15. wp_enqueue_script( 'jetpack-content-options-customizer', plugins_url( 'customizer.js', __FILE__ ), array( 'customize-preview' ), '1.0', true ); 
  16.  
  17. wp_localize_script( 'jetpack-content-options-customizer', 'blogDisplay', array( 
  18. 'display' => get_option( 'jetpack_content_blog_display', $blog_display ),  
  19. 'masonry' => $masonry,  
  20. ) ); 
  21.  
  22. wp_localize_script( 'jetpack-content-options-customizer', 'postDetails', array( 
  23. 'date' => $date,  
  24. 'categories' => $categories,  
  25. 'tags' => $tags,  
  26. 'author' => $author,  
  27. ) );