WordPress.org

Make WordPress Core

Ticket #34549: 34549.3.diff

File 34549.3.diff, 2.2 KB (added by westonruter, 5 years ago)
  • src/wp-includes/class-wp-customize-manager.php

    diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
    index f8bab30..46ff8c7 100644
    final class WP_Customize_Manager { 
    16861686
    16871687                /* Themes */
    16881688
    1689                 $this->add_section( new WP_Customize_Themes_Section( $this, 'themes', array(
     1689                $themes_section = new WP_Customize_Themes_Section( $this, 'themes', array(
    16901690                        'title'      => $this->theme()->display( 'Name' ),
    16911691                        'capability' => 'switch_themes',
    16921692                        'priority'   => 0,
    1693                 ) ) );
     1693                ) );
     1694                $this->add_section( $themes_section );
    16941695
    16951696                // Themes Setting (unused - the theme is considerably more fundamental to the Customizer experience).
    16961697                $this->add_setting( new WP_Customize_Filter_Setting( $this, 'active_theme', array(
    final class WP_Customize_Manager { 
    17281729                        ) ) );
    17291730                }
    17301731
     1732                $themes_section->theme_count = count( $themes );
     1733
    17311734                /* Site Identity */
    17321735
    17331736                $this->add_section( 'title_tagline', array(
  • src/wp-includes/customize/class-wp-customize-themes-section.php

    diff --git src/wp-includes/customize/class-wp-customize-themes-section.php src/wp-includes/customize/class-wp-customize-themes-section.php
    index ecd7833..a2d0c65 100644
    class WP_Customize_Themes_Section extends WP_Customize_Section { 
    2828        public $type = 'themes';
    2929
    3030        /**
     31         * Number of themes.
     32         *
     33         * If this less than 2, the Change button will not be displayed.
     34         *
     35         * @since 4.4.0
     36         * @access public
     37         * @var int
     38         */
     39        public $theme_count = 0;
     40
     41        /**
    3142         * Render the themes section, which behaves like a panel.
    3243         *
    3344         * @since 4.2.0
    class WP_Customize_Themes_Section extends WP_Customize_Section { 
    4657                                }
    4758                                ?>
    4859
    49                                 <button type="button" class="button change-theme" tabindex="0"><?php _ex( 'Change', 'theme' ); ?></button>
     60                                <?php if ( $this->theme_count > 1 ) : ?>
     61                                        <button type="button" class="button change-theme" tabindex="0"><?php _ex( 'Change', 'theme' ); ?></button>
     62                                <?php endif; ?>
    5063                        </h3>
    5164                        <div class="customize-themes-panel control-panel-content themes-php">
    5265                                <h3 class="accordion-section-title customize-section-title">