Make WordPress Core

Changeset 41214


Ignore:
Timestamp:
08/03/2017 01:49:01 PM (6 years ago)
Author:
johnbillion
Message:

Networks and Sites: Display an indicator for the active theme or child theme when viewing a site's themes within Network Admin.

Props palmiak, euthelup

Fixes #41168

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-ms-themes-list-table.php

    r41161 r41214  
    619619
    620620                case 'name':
    621                     echo "<td class='theme-title column-primary{$extra_classes}'><strong>" . $item->display('Name') . "</strong>";
     621
     622                    $active_theme_label = '';
     623
     624                    /* The presence of the site_id property means that this is a subsite view and a label for the active theme needs to be added */
     625                    if ( ! empty( $this->site_id ) ) {
     626                        $stylesheet = get_blog_option( $this->site_id, 'stylesheet' );
     627                        $template   = get_blog_option( $this->site_id, 'template' );
     628
     629                        /* Add a label for the active template */
     630                        if ( $item->get_template() === $template ) {
     631                            $active_theme_label = ' &mdash; ' . __( 'Active Theme' );
     632                        }
     633
     634                        /* In case this is a child theme, label it properly */
     635                        if ( $stylesheet !== $template && $item->get_stylesheet() === $stylesheet) {
     636                            $active_theme_label = ' &mdash; ' . __( 'Active Child Theme' );
     637                        }
     638                    }
     639
     640                    echo "<td class='theme-title column-primary{$extra_classes}'><strong>" . $item->display( 'Name' ) . $active_theme_label . '</strong>';
    622641
    623642                    $this->column_name( $item );
Note: See TracChangeset for help on using the changeset viewer.