customize_themes_print_templates

Print JS templates for the theme-browsing UI in the Customizer.

Description

customize_themes_print_templates(); 

Usage

  1. if ( !function_exists( 'customize_themes_print_templates' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/theme.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = customize_themes_print_templates(); 
  7.  

Defined (1)

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

/wp-admin/includes/theme.php  
  1. function customize_themes_print_templates() { 
  2. $preview_url = esc_url( add_query_arg( 'theme', '__THEME__' ) ); // Token because esc_url() strips curly braces. 
  3. $preview_url = str_replace( '__THEME__', '{{ data.id }}', $preview_url ); 
  4. ?> 
  5. <script type="text/html" id="tmpl-customize-themes-details-view"> 
  6. <div class="theme-backdrop"></div> 
  7. <div class="theme-wrap wp-clearfix"> 
  8. <div class="theme-header"> 
  9. <button type="button" class="left dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show previous theme' ); ?></span></button> 
  10. <button type="button" class="right dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show next theme' ); ?></span></button> 
  11. <button type="button" class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close details dialog' ); ?></span></button> 
  12. </div> 
  13. <div class="theme-about wp-clearfix"> 
  14. <div class="theme-screenshots"> 
  15. <# if ( data.screenshot[0] ) { #> 
  16. <div class="screenshot"><img src="{{ data.screenshot[0] }}" alt="" /></div> 
  17. <# } else { #> 
  18. <div class="screenshot blank"></div> 
  19. <# } #> 
  20. </div> 
  21.  
  22. <div class="theme-info"> 
  23. <# if ( data.active ) { #> 
  24. <span class="current-label"><?php _e( 'Current Theme' ); ?></span> 
  25. <# } #> 
  26. <h2 class="theme-name">{{{ data.name }}}<span class="theme-version"><?php printf( __( 'Version: %s' ), '{{ data.version }}' ); ?></span></h2> 
  27. <h3 class="theme-author"><?php printf( __( 'By %s' ), '{{{ data.authorAndUri }}}' ); ?></h3> 
  28. <p class="theme-description">{{{ data.description }}}</p> 
  29.  
  30. <# if ( data.parent ) { #> 
  31. <p class="parent-theme"><?php printf( __( 'This is a child theme of %s.' ), '<strong>{{{ data.parent }}}</strong>' ); ?></p> 
  32. <# } #> 
  33.  
  34. <# if ( data.tags ) { #> 
  35. <p class="theme-tags"><span><?php _e( 'Tags:' ); ?></span> {{ data.tags }}</p> 
  36. <# } #> 
  37. </div> 
  38. </div> 
  39.  
  40. <# if ( ! data.active ) { #> 
  41. <div class="theme-actions"> 
  42. <div class="inactive-theme"> 
  43. <?php 
  44. /** translators: %s: Theme name */ 
  45. $aria_label = sprintf( __( 'Preview %s' ), '{{ data.name }}' ); 
  46. ?> 
  47. <a href="<?php echo $preview_url; ?>" target="_top" class="button button-primary" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Live Preview' ); ?></a> 
  48. </div> 
  49. </div> 
  50. <# } #> 
  51. </div> 
  52. </script> 
  53. <?php