WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/24/2015 08:30:22 PM (6 years ago)
Author:
markjaquith
Message:

Add theme browsing and theme switching to the Customizer

  • Brings into core the Customizer Theme Switcher feature plugin
  • You can now browse, preview, and activate themes right from the Customizer

fixes #31303.
props celloexpressions, afercia, westonruter, folletto, designsimply

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-section.php

    r31126 r31533  
    313313
    314314/**
     315 * Customize Themes Section Class.
     316 *
     317 * A UI container for theme controls, which behaves like a backwards Panel.
     318 *
     319 * @package WordPress
     320 * @subpackage Customize
     321 * @since 4.2.0
     322 */
     323class WP_Customize_Themes_Section extends WP_Customize_Section {
     324
     325    public $type = 'themes';
     326
     327    /**
     328     * Render the themes section, which behaves like a panel.
     329     *
     330     * @since 4.2.0
     331     */
     332    protected function render() {
     333        $classes = 'accordion-section control-section control-section-' . $this->type;
     334        ?>
     335        <li id="accordion-section-<?php echo esc_attr( $this->id ); ?>" class="<?php echo esc_attr( $classes ); ?>">
     336            <h3 class="accordion-section-title" tabindex="0">
     337                <?php echo esc_html( $this->title ); ?>
     338                <span class="screen-reader-text"><?php _e( 'Press return or enter to expand' ); ?></span>
     339            </h3>
     340            <span class="control-panel-back themes-panel-back" tabindex="-1"><span class="screen-reader-text"><?php _e( 'Back' ); ?></span></span>
     341            <div class="customize-themes-panel control-panel-content themes-php">
     342                <h2><?php esc_html_e( 'Themes' ); ?>
     343                    <span class="title-count theme-count"><?php echo count( $this->controls ) - 1; ?></span>
     344                <?php if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?>
     345                    <a href="<?php echo admin_url( 'theme-install.php' ); ?>" target="_top" class="add-new-h2"><?php echo esc_html_x( 'Add New', 'Add new theme' ); ?></a>
     346                <?php endif; ?>
     347                </h2>
     348                <div class="theme-overlay" tabindex="0" role="dialog" aria-label="<?php esc_attr_e( 'Theme details' ); ?>"></div>
     349                <div id="customize-container"></div>
     350                <?php if ( 6 < count( $this->controls ) ) : ?>
     351                    <p><label for="themes-filter">
     352                        <span class="screen-reader-text"><?php _e( 'Search installed themes...' ); ?></span>
     353                        <input type="search" id="themes-filter" placeholder="<?php esc_attr_e( 'Search installed themes...' ); ?>" />
     354                    </label></p>
     355                <?php endif; ?>
     356                <div class="theme-browser rendered">
     357                    <ul class="themes accordion-section-content">
     358                    </ul>
     359                </div>
     360            </div>
     361        </li>
     362<?php }
     363}
     364
     365/**
    315366 * Customizer section representing widget area (sidebar).
    316367 *
Note: See TracChangeset for help on using the changeset viewer.