Created
February 4, 2015 05:34
-
-
Save bappi-d-great/e172eb8cdf08da6ae5e4 to your computer and use it in GitHub Desktop.
Show Pro Sites list with level
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Shortcode [show_pro_sites] | |
function show_pro_sites_func( $atts ) { | |
global $psts; | |
$sites = wp_get_sites( array( 'limit' => 5000 ) ); | |
$html .= '<table width="100%" cellspacing="0" cellpadding="0">'; | |
$html .= '<tr>'; | |
$html .= '<th>Site Name</th>'; | |
$html .= '<th>Admin</th>'; | |
$html .= '<th>Pro Level</th>'; | |
$html .= '</tr>'; | |
foreach( $sites as $site ) { | |
if( $site['blog_id'] == 1 ) continue; | |
switch_to_blog( $site['blog_id'] ); | |
$html .= '<tr>'; | |
$html .= '<td><a href="' . site_url() . '" target="_blank">' . get_bloginfo( 'name' ) . '</a></td>'; | |
$user = get_user_by( 'email', get_bloginfo( 'admin_email' ) ); | |
$html .= '<td>' . $user->display_name . '</td>'; | |
$html .= '<td>' . $psts->get_level_setting( $psts->get_level( $site['blog_id'] ), 'name' ) . '</td>'; | |
$html .= '</tr>'; | |
restore_current_blog(); | |
} | |
$html .= '</table>'; | |
return $html; | |
} | |
add_shortcode( 'show_pro_sites', 'show_pro_sites_func' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment