February 8, 2012

Get some simple Network stats

I remembered this really neat internal function that is handy to display anywhere you want to show how many sites and users you have in your network.

$stats = get_sitestats();
echo 'There are currently '.$stats[ 'blogs' ].' sites running on this network and '.$stats[ 'users' ].' users.';

Surround that in php tags. :)

For added snazziness and extra bonus points on your homework, go grab a copy of the blank widget Blank Build-A-Widget (1177) paste this code in there, and you’ve just made a network stats widget. Awesome, you rock

Get 3 for the price of 2 in the Network Home Bundle

Includes 3 ebooks with plugins -
Network Home Pages: aggregate global content, set up sitewide tags, create a huge tags cloud like the one seen on WordPress.com, global footers and menus, setting defaults & more
Custom Registration: sign up on sub sites, multilingual signup pages, stop spam blogs
WP Curator: pick and choose posts from sub sites to feature on the main home page of your network

Network Home Pages, Custom Registration & WP Curator – $35.90 for all three. Purchase

Comments

  1. Thao says:

    Is there any way to display additional network stats in a simular fashion? Ie: network post count, network user count, network comment count?

    • Ron says:

      there is nothing for that built into WordPress. You would need to write your own aggregating functions.