WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#41163 closed enhancement (wontfix)

Display active theme name on Sites screen

Reported by: johnbillion Owned by:
Milestone: Priority: normal
Severity: minor Version: 3.0
Component: Networks and Sites Keywords: needs-patch close
Focuses: administration, multisite Cc:

Description

A column should be added to the Sites screen in network admin to display the name of each site's active theme, possibly linked directly to wp-admin/themes.php.

Attachments (1)

41163.diff (1.7 KB) - added by euthelup 4 years ago.
In the light of my last response(excepting the two questions), I come with this patch

Download all attachments as: .zip

Change History (9)

#1 @palmiak
4 years ago

I'm not sure this should be in core.

Yet I've wrote code which does thing, but as I said - not sure shoud this be a plugin or core

<?php
// Hook to columns on sites.php
add_filter( 'wpmu_blogs_columns', 'theme_name_blog_column' );


function theme_name_blog_column( $sites_columns ) {
  // adding column
  $sites_columns = $sites_columns + [ 'theme_name' => __( 'Theme name' ) ];

  return $sites_columns;
}

add_action( 'manage_sites_custom_column', 'theme_name_custom_column', 10, 2 );


function theme_name_custom_column( $column_name, $blog_id ) {
    if ( $column_name == 'theme_name' ) {
        // if it's not default it should be stored as option
        $theme_name = get_blog_option( $blog_id, 'current_theme' );

        //if default used
        if ( ! $theme_name ) {
                $theme_name = wp_get_theme( WP_DEFAULT_THEME )->get( 'Name' );
        }

        $theme_url = get_admin_url( $blog_id, 'themes.php' );

        echo '<a href="'.$theme_url.'">'.$theme_name.'</a>';
    }
}

I'm not also sure where to put this code? In sites.php or somewhere else.

#2 @palmiak
4 years ago

I've read in https://core.trac.wordpress.org/ticket/41167 that place to put stuff like would be ms-functions.php - If so, I can put this functions there.

Version 0, edited 4 years ago by palmiak (next)

#3 @Bueltge
4 years ago

If we implemented this inside the core, then should we also add a list, link in the theme view. Often admins view all themes and she should also listed which theme is in usage, in which site of the network. Maybe also, is a child active and if yes, which parent is necessary so that admins can maintain the list of themes.

I have implemented this in a plugin (info: https://github.com/bueltge/wordpress-multisite-enhancements), the feedback of the user get me the information about this view of content.

I think a new column in the site view is to short in this context.

#4 @euthelup
4 years ago

Hi,

In my opinion, this is a useful feature for admins but also for theme developers who gamble themes in multi-site installs on a daily basis (like me).

Because the multi-site context doesn't have a theme browser, I think that each theme in this column should link to the Appearance tab of the site, directly to the theme's modal.

Also, sites with child-themes should be flagged acordingly.

Should this column be sortable? I mean I'm not yet sure if it will help anyone, but it would be intuitive to order sites by the active theme? Anyway, this would require some patches to WP_Site_Query too since I don't think it supports an order by meta ATM.

In the same idea, a good question would be: When you click on a theme, it will make more sense to display all the sites with the selected theme? Just how the posts column works on the categories page.

@euthelup
4 years ago

In the light of my last response(excepting the two questions), I come with this patch

This ticket was mentioned in Slack in #core-multisite by flixos90. View the logs.


4 years ago

#6 @greatislander
4 years ago

  • Keywords good-first-bug removed

As discussed in Slack, this could take advantage of the blogmeta table to prevent excessive switch_to_blog() calls. It also might make sense to use switch_to_blog() once to collect several pieces of data for the Excerpt view. Some further discussion across a few tickets is probably needed. See also: #40268, #37923.

Last edited 4 years ago by greatislander (previous) (diff)

#7 @flixos90
4 years ago

  • Keywords close added

@johnbillion In my opinion showing each site's active theme is a rather opinionated decision for core. I certainly agree that it can be helpful, but if we start showing as trivial things as the active theme in the sites list table, it would be hard to argue why not to show plugins there as well. All of that could easily make the table cluttered.

#41168 for that purpose makes a lot more sense to me.

The concerns about additional switch_to_blog() statements (as stated above), while not a blocker, make me more hesitant of this change.

I'd suggest closing this ticket, as this is plugin territory to me.

#8 @johnbillion
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.