Support » Plugins » How to display total Post Count and Word Count of blog?

  • I’ve found this “Post Count” and “Word Count” plugins, but they only support old versions (1.2 and 1.5) of WP.

    If anyone knows how to modify these little code snippets to work with WP v2.x, please advise!

    ######################
    POST COUNT for WP v1.5
    ######################

    <?php
    /*
    Plugin Name: Post Count
    Plugin URI: http://mtdewvirus.com/code/wordpress-plugins/
    Description: Outputs the total number of posts.
    Version: 1.1
    Author: Nick Momrik
    Author URI: http://mtdewvirus.com/
    */

    function mdv_post_count() {
    global $wpdb;
    echo $wpdb->get_var(“SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = ‘publish’ AND post_date_gmt < ‘” . gmdate(“Y-m-d H:i:s”,time()) . “‘”);
    }
    ?>

    ##########################
    POST WORD COUNT for WP 1.5
    ##########################

    <?php
    /*
    Plugin Name: Post Word Count
    Plugin URI: http://mtdewvirus.com/code/wordpress-plugins/
    Description: Outputs the total number of words in all posts.
    Version: 1.02
    Author: Nick Momrik
    Author URI: http://mtdewvirus.com/
    */

    function mdv_post_word_count() {
    global $wpdb;
    $now = gmdate(“Y-m-d H:i:s”,time());
    $words = $wpdb->get_results(“SELECT post_content FROM $wpdb->posts WHERE post_status = ‘publish’ AND post_date < ‘$now'”);
    if ($words) {
    foreach ($words as $word) {
    $post = strip_tags($word->post_content);
    $post = explode(‘ ‘, $post);
    $count = count($post);
    $totalcount = $count + $oldcount;
    $oldcount = $totalcount;
    }
    } else {
    $totalcount=0;
    }
    echo number_format($totalcount);
    }
    ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • BUMP… sorry, any ideas out there on this one? I could use it too.

    Here is a plugin that will display the total number of blog posts, comments, categories, or any combination thereof. May be used inside or outside of the loop, and, yes, it works with WordPress 2.x:
    BlogStats PCC

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to display total Post Count and Word Count of blog?’ is closed to new replies.