Home / admin / Add total members to “Right Now” dashboard widget
  • Add total members to “Right Now” dashboard widget

    add-total-members-to-right-now-dashboard-widget

    Great little snippet that will display the total number of members within the Right now dashboard widget. Just add this to the functions.php of your wordpress theme and you are ready to go.

    ( example screenshot )

    wordpress snippet : PHP

    <>
    function dashboard_wps_user_count() {
        global $wpdb;
        $users = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users");
    ?>
    <table>
        <tbody>
           <tr class="first">
              <td class="first b b_pages"><a href="users.php"><? echo $users; ?></a></td>
              <td class="t pages"><a href="users.php">Members</a></td>
           </tr>
         </tbody>
    </table>
    <?}
    add_action( 'right_now_content_table_end', 'dashboard_wps_user_count');
    

    ( WordPress codex functions, hooks, in this snippet. )

    add_action, _n, _e, wp,
  • Anonymous

    This seems to have a number of issues Kevin. For those that may not know the <?} will throw an error. Also, "Members" on the dashboard doesn't show a count.

    • http://wpsnipp.com Kevin Chard

      What issues are you having with the snippet?

  • Ameenullah

    Hi Kein, Happy to land here!! :)
    Thanks for this great snipp!
    Is it possible to add custom post type count also? :)

Build a better with wpsnipp.com

Weekly snippets, themes, deals coupons roundup.

x No Thanks