Spring Sale! Save 30% on all books w/ code: PLANET24
Web Dev + WordPress + Security

BlogStats PCC Plugin

[ BlogStats PCC ] Announcing the BlogStats PCC plugin for WordPress! BlogStats PCC is the easy way to display the total number of posts, comments, categories, as well as several other great statistics for your WordPress-powered website. With BlogStats PCC, you display only the information you want, where you want — inside or outside of the WordPress loop. Completely customizable, BlogStats PCC will display any combination of statistics you choose. This plugin is highly flexible, simple to use, open source, and completely free.

Update: BlogStats PCC has been rebuilt with all new features and options. Check out Simple Blog Stats for all the action! </update>

BlogStats PCC update

New version of BlogStats PCC now available! The new version now provides all of these great site statistics:

  • Total number of posts
  • Total number of comments
  • Total number of categories
  • Total number of members
  • Total number of guests
  • Total number of pages
  • Date of most recent update
  • Most recent commentator
  • Most recent post

Display any or all of the provided site statistics — customize your own set to provide only the statistics you want!

Installation and Usage

  1. Copy blogstats-pcc.php to /wp-content/plugins/
  2. Upload and activate via WordPress plugin admin panel
  3. Use the following tags to display your stats anywhere:
Display the entire set of statistics in a nice list format:
<?php if (function_exists('fullstats')) { fullstats(); } ?>

Display the total number of posts, comments, and categories:
<?php if (function_exists('blogstats')) { blogstats(); } ?>

Display the total number of posts:
<?php if (function_exists('poststats')) { poststats(); } ?>

Display the total number of comments:
<?php if (function_exists('commstats')) { commstats(); } ?>

Display the total number of categories:
<?php if (function_exists('catstats')) { catstats(); } ?>

Display the total number of registered users:
<?php if (function_exists('regusers')) { regusers(); } ?>

Display the total number of unregistered users:
<?php if (function_exists('userstats')) { userstats(); } ?>

Display the total number of individual, static pages:
<?php if (function_exists('pagestats')) { pagestats(); } ?>

Display the date of the most recent post modification:
<?php if (function_exists('modstats')) { modstats(); } ?>

Display a link to the most recently published blog post:
<?php if (function_exists('recpost')) { recpost(); } ?>

Display the name of the most recent commentator as a link:
<?php if (function_exists('reccomm')) { reccomm(); } ?>

Display the date of the last update in your blog's default date format:
<?php if (function_exists('recstats')) { recstats(); } ?>
Check it out: Simple Blog Stats »

About the Author
Jeff Starr = Web Developer. Security Specialist. WordPress Buff.
USP Pro: Unlimited front-end forms for user-submitted posts and more.

110 responses to “BlogStats PCC Plugin”

  1. great little plugin. i have a 2 questions i want to ask before i go screwing up the php file.

    1. changing the number of recent posts and comments listed
    2. You had said that “guests” is actually users who have registered. how do i change “guests” to something that would reflect that, like “registered Users”?

  2. billy,

    not sure if i am understanding the first question.. the number of posts/comments is generated from database statistics. changing the number of either requires altering the actual number of posts/comments in the database itself (e.g., by adding/deleting posts).

    the second question is easy. open the file and go to line #114. change the word "guests" to whatever you prefer. no additional editing should be necessary.

  3. Hello,

    thanks for this great plugin Perishable ;)

    I translate this in French: [Edit: getting 404 for original page link — see download section of the article above for the translated version]

    It is also available on the official French WordPress site.

  4. Arkan,
    Very nice! Thank you for your help. The translation is excellent. Keep up the good work!
    Regards,
    Jeff

  5. Christopher 2007/06/17 12:49 pm

    Finally I have found a great plugin to show a the stats about my blog – thank you.
    I like the way I can list posts and pages separately, but it seems to miss out a whole load of sub pages. Any ideas??

  6. Perishable 2007/06/18 8:42 am

    Yes, open the plugin file, find the function called function pagestats(), and replace this line:

    $numpages = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'static'");

    with this one:

    $numpages = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE (post_status = 'static') AND (post_parent >= '0')");

    That should do the trick. Let us know how it goes..

  7. Christopher 2007/06/18 4:45 pm

    Thanks for the amended code, unfortunately no change. Still showing 6 pages.
    If I change it to (post_parent >= '1') it then says 2 pages.

    At the moment your plugin is reporting:
    59 posts and 6 pages in 11 categories with 56 comments

    While the WP Dashboard reports:
    There are currently 43 posts and 56 comments, contained within 11 categories.

    Probably should have said I am using WP2.1
    Thanks for your help.

  8. Perishable 2007/06/18 6:02 pm

    I don’t have WordPress 2.1 running for this site (yet), but I may have an opportunity later tonight or tomorrow to investigate the situation on a different domain. It should be just a matter of culling the desired page data from the correct database tables, which indeed may have been changed in WP2.1. I’ll see what I can do.. stay tuned..

  9. Exellent, it works very well. Very usefull tool ;)

  10. i just installed this plugin on my blog and i love it! thank you!

  11. Perishable 2007/09/11 8:46 am

    Excellent, Manele — I love to hear positive feedback! Thanks for the comment!

  12. J.M. Snyder 2007/09/22 5:00 pm

    Hi,

    Great plug-in! However, I’m using the “poststats” function and it’s returning the number of all my posts AND my pages.

    Your plug-in stats: 57 posts, 0 pages

    WordPress dashboard: 50 posts

    I have 1 post that’s marked private and 1 page marked private, for a total of 51 posts and 8 pages.

    Any clue why this may be happening?

    Thanks in advance!

    J.M. Snyder

Comments are closed for this post. Something to add? Let me know.
Welcome
Perishable Press is operated by Jeff Starr, a professional web developer and book author with two decades of experience. Here you will find posts about web development, WordPress, security, and more »
BBQ Pro: The fastest firewall to protect your WordPress.
Thoughts
I live right next door to the absolute loudest car in town. And the owner loves to drive it.
8G Firewall now out of beta testing, ready for use on production sites.
It's all about that ad revenue baby.
Note to self: encrypting 500 GB of data on my iMac takes around 8 hours.
Getting back into things after a bit of a break. Currently 7° F outside. Chillz.
2024 is going to make 2020 look like a vacation. Prepare accordingly.
First snow of the year :)
Newsletter
Get news, updates, deals & tips via email.
Email kept private. Easy unsubscribe anytime.