• ok, another question.

    I want to make a blog statistics thingie in my sidebar, containing number of entries, pages, categories and comments. I looked through the template tag list but didn’t see anything that matches the thing I’m looking for.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter keikenti

    (@keikenti)


    <div>
    <h3><?php _e('Blog Stats'); ?></h3>
    <?php
    $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
    if (0 < $numposts) $numposts = number_format($numposts);

    $numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
    if (0 < $numcomms) $numcomms = number_format($numcomms);

    $numcats = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories");
    if (0 < $numcats) $numcats = number_format($numcats);
    ?>
    <?php printf(__('There are currently %1$s posts and %3$s comments, contained within %5$s categories.'), $numposts, 'edit.php', $numcomms, 'edit-comments.php', $numcats, 'categories.php'); ?>
    </div>

    I guess that is the code I was looking for (snagged from wp-admin/index.php)

    maybe the wp-stats plugin is something you’re looking for?

    Hi keikenti,

    I’ve made some small counter-plugins because I wanted them – counting characters, comments, posts, users to comment and such.

    They’re all available from https://linux.linux.dk/projects/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘blog statistics’ is closed to new replies.