class-wp-customize-themes-section.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /**
  3. * Customize API: WP_Customize_Themes_Section class
  4. *
  5. * @package WordPress
  6. * @subpackage Customize
  7. * @since 4.4.0
  8. */
  9. /**
  10. * Customize Themes Section class.
  11. *
  12. * A UI container for theme controls, which behaves like a backwards Panel.
  13. *
  14. * @since 4.2.0
  15. *
  16. * @see WP_Customize_Section
  17. */
  18. class WP_Customize_Themes_Section extends WP_Customize_Section {
  19. /**
  20. * Customize section type.
  21. *
  22. * @since 4.2.0
  23. * @access public
  24. * @var string
  25. */
  26. public $type = 'themes';
  27. /**
  28. * Render the themes section, which behaves like a panel.
  29. *
  30. * @since 4.2.0
  31. * @access protected
  32. */
  33. protected function render() {
  34. $classes = 'accordion-section control-section control-section-' . $this->type;
  35. ?>
  36. <li id="accordion-section-<?php echo esc_attr( $this->id ); ?>" class="<?php echo esc_attr( $classes ); ?>">
  37. <h3 class="accordion-section-title">
  38. <?php
  39. if ( $this->manager->is_theme_active() ) {
  40. echo '<span class="customize-action">' . __( 'Active theme' ) . '</span> ' . $this->title;
  41. } else {
  42. echo '<span class="customize-action">' . __( 'Previewing theme' ) . '</span> ' . $this->title;
  43. }
  44. ?>
  45. <?php if ( count( $this->controls ) > 0 ) : ?>
  46. <button type="button" class="button change-theme" tabindex="0"><?php _ex( 'Change', 'theme' ); ?></button>
  47. <?php endif; ?>
  48. </h3>
  49. <div class="customize-themes-panel control-panel-content themes-php">
  50. <h3 class="accordion-section-title customize-section-title">
  51. <span class="customize-action"><?php _e( 'Customizing' ); ?></span>
  52. <?php _e( 'Themes' ); ?>
  53. <span class="title-count theme-count"><?php echo count( $this->controls ) + 1 /* Active theme */; ?></span>
  54. </h3>
  55. <h3 class="accordion-section-title customize-section-title">
  56. <?php
  57. if ( $this->manager->is_theme_active() ) {
  58. echo '<span class="customize-action">' . __( 'Active theme' ) . '</span> ' . $this->title;
  59. } else {
  60. echo '<span class="customize-action">' . __( 'Previewing theme' ) . '</span> ' . $this->title;
  61. }
  62. ?>
  63. <button type="button" class="button customize-theme"><?php _e( 'Customize' ); ?></button>
  64. </h3>
  65. <div class="theme-overlay" tabindex="0" role="dialog" aria-label="<?php esc_attr_e( 'Theme Details' ); ?>"></div>
  66. <div id="customize-container"></div>
  67. <?php if ( count( $this->controls ) > 4 ) : ?>
  68. <p><label for="themes-filter">
  69. <span class="screen-reader-text"><?php _e( 'Search installed themes&hellip;' ); ?></span>
  70. <input type="text" id="themes-filter" placeholder="<?php esc_attr_e( 'Search installed themes&hellip;' ); ?>" />
  71. </label></p>
  72. <?php endif; ?>
  73. <div class="theme-browser rendered">
  74. <ul class="themes accordion-section-content">
  75. </ul>
  76. </div>
  77. </div>
  78. </li>
  79. <?php }
  80. }