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


git-svn-id: https://develop.svn.wordpress.org/trunk@41214 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn 2017-08-03 13:49:01 +00:00
parent 1a53140ba3
commit 9296c9025a

View File

@ -618,7 +618,26 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
break; break;
case 'name': case 'name':
echo "<td class='theme-title column-primary{$extra_classes}'><strong>" . $item->display('Name') . "</strong>";
$active_theme_label = '';
/* 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 */
if ( ! empty( $this->site_id ) ) {
$stylesheet = get_blog_option( $this->site_id, 'stylesheet' );
$template = get_blog_option( $this->site_id, 'template' );
/* Add a label for the active template */
if ( $item->get_template() === $template ) {
$active_theme_label = ' &mdash; ' . __( 'Active Theme' );
}
/* In case this is a child theme, label it properly */
if ( $stylesheet !== $template && $item->get_stylesheet() === $stylesheet) {
$active_theme_label = ' &mdash; ' . __( 'Active Child Theme' );
}
}
echo "<td class='theme-title column-primary{$extra_classes}'><strong>" . $item->display( 'Name' ) . $active_theme_label . '</strong>';
$this->column_name( $item ); $this->column_name( $item );