Add Post Count To Each Article In WordPress

Wednesday 6 July 2005 @ 6:53 pm

Ok, as promise to a blog buddy of mine, Kah Soon, that I will share a small plugin to show the post count in each for the the article as shown in the picture below.

Post Count

Please follow the steps:-

  • 1. Download Top10 plugin for WordPress.
  • 2. Login to your database, either through phpMyAdmin or telnet.
    Create a table called mostAccessed, by using this SQL query:-
    [sql]create table mostAccessed
    (
    postnumber int not null,
    cntaccess int not null,
    primary key(postnumber),
    unique id(postnumber)
    );[/sql]
  • 3. Find this line to your index.php:-
    [php]
    < ?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    [/php]
    Then add the following code below the line:-
    [php]< ?php if ($id > 0) { add_count($id); } ?>[/php]
  • 4. Look for this line in index.php too:-
    [php]< ?php the_title(); ?>[/php]
    Then, add the following code below the line:-
    [php]< ?php if (!( is_home() || is_page() )) { ?>
    < ?php show_post_count($post->ID,
    $before=”This post has been viewed “,
    $after=”
    times since “); ?>
    < ?php } ?>[/php]
  • That’s it. :)

The post count will appear whenever the single page of the article is shown.


Blogsphere: TechnoratiFeedsterBloglines
Bookmark: Del.icio.usSpurlFurlSimpyBlinkDigg
RSS feed for comments on this post








8 Responses to 'Add Post Count To Each Article In WordPress'

  1. SapiensBryan - July 6th, 2005 at 10:58 am

    Hey Kah Soon,

    You actually have already downloaded the plugin and left a “very nice!” comment there. LoL

    Anyway, hope my tutorial helps. :)

  2. SapiensBryan - July 6th, 2005 at 6:58 pm

    Hey Kah Soon,

    You actually have already downloaded the plugin and left a “very nice!” comment there. LoL

    Anyway, hope my tutorial helps. :)

  3. lilian - July 6th, 2005 at 5:51 pm

    Why everyone WP, WP leh. I use 2 MTs and one WP (neglected blog). My MT can do spam control like yours or not ha? ‘Cos spam is killing me even with MT blacklist. BTW, I link you as Bryan ah?

  4. lilian - July 7th, 2005 at 1:51 am

    Why everyone WP, WP leh. I use 2 MTs and one WP (neglected blog). My MT can do spam control like yours or not ha? ‘Cos spam is killing me even with MT blacklist. BTW, I link you as Bryan ah?

  5. SapiensBryan - July 6th, 2005 at 6:20 pm

    Hi Lilian,

    Yup, I’m bryan.

    ErrR… Why WP ah? Because I’m using it mah. I have already been using WP since the beginning and this is my first ever blog.

    This spam control is a nice plugin written by some really nice guy. Don’t know any nice guy using MT is willing to write a similar one. Anyway, before I used this spam control, I held every commment for moderation before been posted. But moderating thousand of spam is quite irritating. :( Spam problem is going rampant these days, sigh…

  6. SapiensBryan - July 7th, 2005 at 2:20 am

    Hi Lilian,

    Yup, I’m bryan.

    ErrR… Why WP ah? Because I’m using it mah. I have already been using WP since the beginning and this is my first ever blog.

    This spam control is a nice plugin written by some really nice guy. Don’t know any nice guy using MT is willing to write a similar one. Anyway, before I used this spam control, I held every commment for moderation before been posted. But moderating thousand of spam is quite irritating. :( Spam problem is going rampant these days, sigh…

  7. Prohor - September 27th, 2006 at 12:50 am

    Thank for making this valuable information available to the public.

  8. Prohor - September 27th, 2006 at 8:50 am

    Thank for making this valuable information available to the public.

Powered by Disqus

Apple iPad & Maxis WiFi Modem Reviews «
Apple iPad & Maxis WiFi Modem Reviews
Nokia N8 Reviews «
Nokia N8 Reviews
Samsung Galaxy S Reviews «
Samsung Galaxy S Reviews
Nokia N900 Reviews «
Nokia N900 Reviews
Nokia N97 Reviews «
Nokia N97 Reviews



.................................

Live Stats

Recent Posts

Favorite Icon



My QR Code A List Blogger