WordPress.org

Make WordPress Core

Ticket #26890: 26890.1.diff

File 26890.1.diff, 3.1 KB (added by celloexpressions, 6 years ago)

First-pass at a themes panel that links to themes.php (not fully functional). Implemented as a custom panel for forward compat.

  • src/wp-admin/css/customize-controls.css

     
    145145        padding-right: 54px;
    146146}
    147147
    148 .control-section.control-panel > .accordion-section-title:after {
     148.control-section.control-panel > .accordion-section-title:after,
     149#accordion-panel-themes .accordion-section-title:after {
    149150        content: "\f345";
    150151        background: #f5f5f5;
    151152        color: #555;
     
    162163        content: "\f341";
    163164}
    164165
     166#accordion-panel-themes .accordion-section-title:after {
     167        content: "\f341";
     168}
     169
     170.rtl #accordion-panel-themes .accordion-section-title:after {
     171        content: "\f345";
     172}
     173
    165174#customize-theme-controls .control-section.control-panel > h3.accordion-section-title:focus:after,
    166 #customize-theme-controls .control-section.control-panel > h3.accordion-section-title:hover:after {
     175#customize-theme-controls .control-section.control-panel > h3.accordion-section-title:hover:after,
     176#customize-theme-controls #accordion-panel-themes h3.accordion-section-title:focus:after,
     177#customize-theme-controls #accordion-panel-themes h3.accordion-section-title:hover:after {
    167178        background: #ddd;
    168179        color: #000;
    169180        border: 1px solid #d9d9d9;
  • src/wp-includes/class-wp-customize-manager.php

     
    11821182                        'section'    => 'static_front_page',
    11831183                        'type'       => 'dropdown-pages',
    11841184                ) );
     1185
     1186                // Themes.
     1187                $this->add_panel( new WP_Customize_Themes_Panel( $this, 'themes', array(
     1188                        'title'    => sprintf( __( 'Theme: %s' ), $this->theme()->display('Name') ),
     1189                        'priority' => 0,
     1190                ) ) );
     1191                $this->add_section( 'themes_placeholder', array( 'panel' => 'themes' ) );
     1192                $this->add_setting( 'themes_placeholder', array() );
     1193                $this->add_control( 'themes_placeholder', array( 'section' => 'themes_placeholder' ) );
    11851194        }
    11861195
    11871196        /**
  • src/wp-includes/class-wp-customize-panel.php

     
    198198                </li>
    199199                <?php
    200200        }
     201}
     202
     203/**
     204 * A placeholder panel for themes.
     205 *
     206 * @package WordPress
     207 * @subpackage Customize
     208 * @since 4.1.0
     209 */
     210class WP_Customize_Themes_Panel extends WP_Customize_Panel {
     211       
     212        /**
     213         * Render the panel as a linked panel heading.
     214         *
     215         * @since 4.1.0
     216         */
     217        function render() {
     218                ?>
     219                <li id="accordion-panel-<?php echo esc_attr( $this->id ); ?>" class="control-section control-panel accordion-section">
     220                        <a href="<?php echo admin_url( 'themes.php' ); ?>" class="theme-switch">
     221                                <h3 class="accordion-section-title" tabindex="0">
     222                                        <?php echo esc_html( $this->title ); ?>
     223                                        <span class="screen-reader-text"><?php _e( 'Press return or enter to open this panel' ); ?></span>
     224                                </h3>
     225                        </a>
     226                </li>
     227                <?php
     228        }
    201229}
     230 No newline at end of file