Make WordPress Core

Ticket #44891: 44891.2.diff

File 44891.2.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..7489272 100644
    if ( $tab ) { 
    275275        </div>
    276276
    277277        <div class="theme-id-container">
    278                 <h3 class="theme-name">{{ data.name }}</h3>
    279 
    280                 <div class="theme-actions">
    281                         <# if ( data.installed ) { #>
     278                <# if ( data.active ) { #>
     279                        <h3 class="theme-name">
    282280                                <?php
    283281                                /* translators: %s: Theme name */
    284                                 $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
     282                                printf( __( '<span>Active:</span> %s' ), '{{{ data.name }}}' );
    285283                                ?>
    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>
     284                        </h3>
     285                <# } else { #>
     286                        <h3 class="theme-name">{{ data.name }}</h3>
     287                <# } #>
     288
     289                <div class="theme-actions">
     290                        <# if ( data.installed ) { #>
     291                                <# if ( ! data.active ) { #>
     292                                        <# if ( data.activate_url ) { #>
     293                                                <a class="button button-primary activate" href="{{ data.activate_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
     294                                        <# } #>
     295                                        <# if ( data.customize_url ) { #>
     296                                                <a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Live Preview' ); ?></a>
     297                                        <# } else { #>
     298                                                <button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button>
     299                                        <# } #>
    291300                                <# } else { #>
    292                                         <button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button>
     301                                        <# if ( data.customize_url ) { #>
     302                                                <a class="button button-primary customize load-customize hide-if-no-customize" href="{{{ data.customize_url }}}"><?php _e( 'Customize' ); ?></a>
     303                                        <# } #>
    293304                                <# } #>
    294305                        <# } else { #>
    295306                                <?php
    if ( $tab ) { 
    314325                        <button class="previous-theme"><span class="screen-reader-text"><?php _e( 'Previous theme' ); ?></span></button>
    315326                        <button class="next-theme"><span class="screen-reader-text"><?php _e( 'Next theme' ); ?></span></button>
    316327                        <# if ( data.installed ) { #>
    317                                 <a class="button button-primary activate" href="{{ data.activate_url }}"><?php _e( 'Activate' ); ?></a>
     328                                <# if ( ! data.active ) { #>
     329                                        <a class="button button-primary activate" href="{{ data.activate_url }}"><?php _e( 'Activate' ); ?></a>
     330                                <# } #>
    318331                        <# } else { #>
    319332                                <a href="{{ data.install_url }}" class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></a>
    320333                        <# } #>
    321334                </div>
    322335                <div class="wp-full-overlay-sidebar-content">
    323336                        <div class="install-theme-info">
    324                                 <h3 class="theme-name">{{ data.name }}</h3>
     337                                <# if ( data.active ) { #>
     338                                        <h3 class="theme-name">
     339                                                <?php
     340                                                /* translators: %s: Theme name */
     341                                                printf( __( '<span>Active:</span> %s' ), '{{{ data.name }}}' );
     342                                                ?>
     343                                        </h3>
     344                                <# } else { #>
     345                                        <h3 class="theme-name">{{ data.name }}</h3>
     346                                <# } #>
    325347                                        <span class="theme-by">
    326348                                                <?php
    327349                                                /* translators: %s: Theme author name */