Display Blog Subscribers In WordPress

WordPress allows your site visitors to subscribe to your blog to get all the latest articles you publish in their inbox. But some of you may want to show your blog power and decide to display all the subscribers of your blog. Achieving this is not difficult too, just add the below code to your theme file, wherever you want to display your blog subscribers.

<ul class="subscribers"> <?php     $blogusers = get_users('blog_id=1&orderby=display_name&number=100&role=subscriber');     foreach ($blogusers as $user) {          echo '<li>' . $user->display_name . '</li>';     } ?> </ul>

The result will give an unordered list with the subscribers class. You can customize the look by targeting the subscribers class.

There are many things that can be changed in this query. The number in the blue color is the total number of subscribers it will return. Change it with any number you want. You can also change the role to any accepted value, to display people according to the role you specify. Visit the get_user function page on WordPress codex to see what all can be customized.

Related Post