Created
May 22, 2018 20:40
-
-
Save rupokify/4f2ef605419a3cb6c2d0cdcf62cac558 to your computer and use it in GitHub Desktop.
Show List of Blogs + Pro Sites Status of Each Blog
This file contains 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
function show_blog_list() { | |
$user_id = get_current_user_id(); | |
if ($user_id == 0) { | |
echo 'You are not logged in.'; | |
} else { | |
echo '<h2>Your Blog List with Prosite Levels</h2>'; | |
$user_blogs = get_blogs_of_user( $user_id ); | |
foreach ($user_blogs AS $user_blog) { | |
global $psts; | |
echo '<li><a href="'.$user_blog->siteurl.'">'.$user_blog->blogname.'</a> - Pro Sites Level: '.$psts->get_level( $user_blog->userblog_id ).'</li>'; | |
} | |
echo '</ul>'; | |
} | |
} | |
add_shortcode( 'bloglist', 'show_blog_list' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment