Add Post Count To Each Article In WordPress

This post has been viewed 10671 times since 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
 |  TrackBack URI for this post








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

Recent Comments

Recent Trackbacks

Favorite Icon



My QR Code A List Blogger