Advertisement
dubajicp

Untitled

Jan 19th, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.18 KB | None | 0 0
  1. /*
  2.  * Use [show_subsite_admin]
  3.  */
  4.  
  5.  function show_subsite_admin_func( $atts ) {
  6.     $a = shortcode_atts( array(
  7.         'exclude' => ''
  8.     ), $atts );
  9.  
  10.     $sites = wp_get_sites( array( 'limit' => 5000 ) );
  11.    
  12.     $html .= '<table width="100%" cellspacing="0" cellpadding="0">';
  13.     $html .= '<tr>';
  14.     $html .= '<th>Site Name</th>';
  15.     $html .= '<th>Admin</th>';
  16.     $html .= '<th>Email</th>';
  17.     $html .= '<th>Bio</th>';
  18.     $html .= '<th>Avatar</th>';
  19.     $html .= '</tr>';
  20.    
  21.     foreach( $sites as $site ) {
  22.         if( $site['blog_id'] == 1 ) continue;
  23.     switch_to_blog( $site['blog_id'] );
  24.     $html .= '<tr>';
  25.     $html .= '<td><a href="' . site_url() . '" target="_blank">' . get_bloginfo( 'name' ) . '</a></td>';
  26.     $user = get_user_by( 'email', get_bloginfo( 'admin_email' ) );
  27.     $html .= '<td>' . $user->display_name . '</td>';
  28.     $html .= '<td>' . get_bloginfo( 'admin_email' ) . '</td>';
  29.     $html .= '<td>' . $user->description . '</td>';
  30.     $html .= '<td>' . get_avatar( get_bloginfo( 'admin_email' ) , 40) . '</td>';
  31.     $html .= '</tr>';
  32.     restore_current_blog();
  33.     }
  34.     $html .= '</table>';
  35.     return $html;
  36.    
  37. }
  38. add_shortcode( 'show_subsite_admin', 'show_subsite_admin_func' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement