[wp-trac] [WordPress Trac] #41163: Display active theme name on Sites screen
WordPress Trac
noreply at wordpress.org
Wed Jun 28 11:50:26 UTC 2017
#41163: Display active theme name on Sites screen
-------------------------------------+-------------------------------------
Reporter: johnbillion | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Networks and Sites | Version: 3.0
Severity: minor | Resolution:
Keywords: needs-patch good-first- | Focuses: administration,
bug | multisite
-------------------------------------+-------------------------------------
Comment (by palmiak):
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
<?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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41163#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list