Make WordPress Core

Ticket #44891: 44891.3.diff

File 44891.3.diff, 4.0 KB (added by birgire, 6 years ago)
  • src/wp-admin/includes/ajax-actions.php

    diff --git src/wp-admin/includes/ajax-actions.php src/wp-admin/includes/ajax-actions.php
    index db22db2..ccc880b 100644
    function wp_ajax_query_themes() { 
    32133213                wp_send_json_error();
    32143214        }
    32153215
     3216        $current_theme = get_stylesheet();
     3217
    32163218        $update_php = network_admin_url( 'update.php?action=install-theme' );
    32173219        foreach ( $api->themes as &$theme ) {
    32183220                $theme->install_url = add_query_arg(
    function wp_ajax_query_themes() { 
    32683270                );
    32693271                $theme->num_ratings = number_format_i18n( $theme->num_ratings );
    32703272                $theme->preview_url = set_url_scheme( $theme->preview_url );
     3273                $theme->active      = ( $theme->slug === $current_theme );
    32713274        }
    32723275
    32733276        wp_send_json_success( $api );
  • src/wp-admin/theme-install.php

    diff --git src/wp-admin/theme-install.php src/wp-admin/theme-install.php
    index 369cb87..b471f4e 100644
    if ( $tab ) { 
    275275        </div>
    276276
    277277        <div class="theme-id-container">
    278                 <h3 class="theme-name">{{ data.name }}</h3>
     278                <# if ( data.active ) { #>
     279                        <h3 class="theme-name">
     280                                <?php
     281                                /* translators: %s: Theme name */
     282                                printf( __( '<span>Active:</span> %s' ), '{{{ data.name }}}' );
     283                                ?>
     284                        </h3>
     285                <# } else { #>
     286                        <h3 class="theme-name">{{ data.name }}</h3>
     287                <# } #>
    279288
    280289                <div class="theme-actions">
    281290                        <# if ( data.installed ) { #>
    if ( $tab ) { 
    283292                                /* translators: %s: Theme name */
    284293                                $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
    285294                                ?>
    286                                 <# if ( data.activate_url ) { #>
    287                                         <a class="button button-primary activate" href="{{ data.activate_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
    288                                 <# } #>
    289                                 <# if ( data.customize_url ) { #>
    290                                         <a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Live Preview' ); ?></a>
     295                                <# if ( ! data.active ) { #>
     296                                        <# if ( data.activate_url ) { #>
     297                                                <a class="button button-primary activate" href="{{ data.activate_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
     298                                        <# } #>
     299                                        <# if ( data.customize_url ) { #>
     300                                                <a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Live Preview' ); ?></a>
     301                                        <# } else { #>
     302                                                <button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button>
     303                                        <# } #>
    291304                                <# } else { #>
    292                                         <button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button>
     305                                        <# if ( data.customize_url ) { #>
     306                                                <a class="button button-primary customize load-customize hide-if-no-customize" href="{{{ data.customize_url }}}"><?php _e( 'Customize' ); ?></a>
     307                                        <# } #>
    293308                                <# } #>
    294309                        <# } else { #>
    295310                                <?php
    if ( $tab ) { 
    314329                        <button class="previous-theme"><span class="screen-reader-text"><?php _e( 'Previous theme' ); ?></span></button>
    315330                        <button class="next-theme"><span class="screen-reader-text"><?php _e( 'Next theme' ); ?></span></button>
    316331                        <# if ( data.installed ) { #>
    317                                 <a class="button button-primary activate" href="{{ data.activate_url }}"><?php _e( 'Activate' ); ?></a>
     332                                <# if ( ! data.active ) { #>
     333                                        <a class="button button-primary activate" href="{{ data.activate_url }}"><?php _e( 'Activate' ); ?></a>
     334                                <# } #>
    318335                        <# } else { #>
    319336                                <a href="{{ data.install_url }}" class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></a>
    320337                        <# } #>
    321338                </div>
    322339                <div class="wp-full-overlay-sidebar-content">
    323340                        <div class="install-theme-info">
    324                                 <h3 class="theme-name">{{ data.name }}</h3>
     341                                <# if ( data.active ) { #>
     342                                        <h3 class="theme-name">
     343                                                <?php
     344                                                /* translators: %s: Theme name */
     345                                                printf( __( '<span>Active:</span> %s' ), '{{{ data.name }}}' );
     346                                                ?>
     347                                        </h3>
     348                                <# } else { #>
     349                                        <h3 class="theme-name">{{ data.name }}</h3>
     350                                <# } #>
    325351                                        <span class="theme-by">
    326352                                                <?php
    327353                                                /* translators: %s: Theme author name */