WordPress Plugin: Daily Top 10 Posts

If you want to know how much hits your posts are receiving on a daily basis, then the Daily Top 10 Posts plugin is for you. What it does is track the hits of each blog post for the current day and cumulatively at the same time. You may also display sidebar widgets containing a list of the most popular posts for the day and most popular posts overall.

Plugin Name: Daily Top 10 Posts
Description: Tracks the number of pageviews per blog post for the current day and cumulatively with options to display sidebar widgets for both.
Author: Andrew dela Serna
Version: 0.7
Notice: Compatible with WordPress 2.7-2.8.
Disclaimer: This is a standalone plugin. If you have been using the Top 10 plugin, please be advised that using the Daily Top 10 Posts plugin means your pageviews will start from zilch.

INSTALLATION
————
1A. WordPress 2.7-2.8 users, download the plugin from http://www.alleba.com/blog/wp-downloads/dailytop10.zip
1B. WordPress 2.6 and below users, download the plugin from http://www.alleba.com/blog/wp-downloads/dailytop10.zip
2. Extract and upload dailytop10.php to 'yourserver.com/wp-content/plugins/'
3. Login to your WordPress admin panel and browse to the Plugins section.
4. Activate The Daily Top 10 Posts plugin.

INSTRUCTIONS
————
1. Go to Admin Panel > Design > Theme Editor and click on Single Post (single.php).

#Find this line:

<?php the_time('F jS, Y') ?> //date

#Right after it, insert this line:
<br /><?php if (function_exists('todays_overall_count')) { todays_overall_count($post->ID, 'Visited', 'times', 'so far today', '0', 'show'); } ?>

#The line will display something like “Visited 300 times, 25 so far today” while viewing an individual post.
#You may edit the wording to suit your preference.
#If you wish to leave a word/phrase empty, use two quotes '' instead of just leaving it completely blank.
#Insert only one instance of this line to avoid double tracking.
#Change '0' to '1' if you wish to track unique sessions.
#Change 'show' to 'noshow' if you donot wish to display the post count information.

2. To display the number of views per post on the main index page, click on Main Index Template (index.php) in the Theme Editor panel.

#Find this line:

<?php the_time('F jS, Y') ?>

#Right after it, insert this line:

<br /><?php if (function_exists('todays_overall_main')) { todays_overall_main($post->ID, 'Viewed', 'times', 'so far today'); } ?>

#The line will display something like “Visited 300 times, 25 so far today” under each post heading
#while browsing your main page.
#You may edit the wording to suit your preference.
#If you wish to leave a word/phrase empty, use two quotes '' instead of just leaving it completely blank.

3. To add the sidebar widget, you may add it directly in the widgets panel of your theme (Design > Widgets). If your theme is not widget-ready, click on sidebar.php in the Theme Editor panel and do the following:

#Add the following code:

<h3>Top Posts for Today</h3>
<?php if (function_exists('todays_count_widget')) { todays_count_widget('views', 'ul'); }?>

#You may edit the word “views” to your liking (e.g. visits, pageviews or leave it empty '').
#The list format defaults to an unordered list (ul). If you would like an ordered list, change it to 'ol'.

4. To add the sidebar widget to show your most popular posts overall, you may add it directly in the widgets panel of your theme (Design > Widgets). If your theme is not widget-ready, click on sidebar.php in the Theme Editor panel and do the following:
#Add the following code:

<h3>Overall Top Posts</h3>
<?php if (function_exists('todays_overall_count_widget')) { todays_overall_count_widget('views', 'ul'); } ?>

#You may edit the word “views” to your liking (e.g. visits, pageviews or leave it empty '').
#The list format defaults to an unordered list (ul). If you would like an ordered list, change it to 'ol'.

Update: Now has the ability to track unique hits based on sessions. See instruction #1 for implementation.

0.2 Update: A serious flaw has been found that prevents the daily count from incrementing. Please download the latest version to correct this.

0.3 Update: Numerous bugs corrected. For more, read this post.

0.4 Update: Numerous bugs corrected. Added support for widgets. For more, read this post.

0.5 Update: Bugs in WordPress 2.7 corrected. Check this post.

0.6 Update: CSS bugs in WordPress 2.7 corrected. Check this post.

0.7 Update: Ability to exclude posts added. Tested to work on WordPress 2.8 Check this post.

As always, I am open to your comments and suggestions. I hope you like this one! Thanks!

276 comments

  1. I need your help to exclude few posts from recording the read count. I have few posts which has a read count which doesnot tall with Google analytics or WordPress Analytics or other tools. The other posts are reasoanably tallied and i think these numbers in few posts are inflated read count.

    Would you please help me on how to exclude few posts ?
    I apprecite your help and plugin !

    Thanks

  2. Andrew – I read the previous comments and I think what I’m asking is the same thing everyone else is asking – I get how to change $show to $noshow in instruction #1 but how do you do it for the widgets, which is where I want to remove the information? Thanks!

  3. Any help on excluding a post from recording the read count would be greatly appreciated.

    Is there a way to not to display read counts only for one post ?

  4. Hi all, I’d like to let you guys know that I am working on a new version of the plugin which incorporates exluding certain posts and pages from tracking. It should be ready in 1-2 days. Look out for an announcement. Thanks for your patience!

  5. For some reason your plugin doesn’t work with my site. I added it to the left sidebar of my site so you can see, and I haven’t modified the code at all. Is this a problem with one of the other plugins I use or have I don’e something wrong? Any help would be greatly appreciated.

  6. Hello,
    I am using the starscape template for my blog and I don’t seem to be able to implement the code as per step 1 and 2 above. Any ideas, please?
    Thank you,

    Rossi Ignatova

  7. Hi,
    That is a very nice and clean plug-in, but there are a few things that made me uninstall it.

    1. I wish the options were built right into the widget, and
    2. It logs my (admin) visits to each post as well, and I did not see a way around that. Needs filters.

    If you can resolve those 2 issues, it would be perfect.

    Thanks! : )

  8. Hey, is it possible to make this plugin use javascript to the post views can be tracked even when using the supercache plugin which uses static .html files?

    I really like this plugin but i also want to cache my pages!

  9. Hi Andrew,

    After going through few comments and googling, i still feel that an answer needs to be updated in the post (instruction #3 ) about removing view count in the widget.

    Thanks in advance.

  10. Daily Top Ten posts is a great plugin! Thanks for the hard work. I do have one feature request. I was going to modify this myself but figured it was easy enough to just shoot you a message.

    It would be nice if there was a Checkbox option that would allow Daily Top 10 to record stats ONLY from web browser. Basically detect the “Mozilla” UserAgent and count only for that, that way you don’t get hits counted from search engines.

    Anyway, thanks a ton!
    -Jim

  11. Hai andrew

    i have an small problem.

    i am using wordpress digital statement them.they install your plugin by default.if you check my sites footer, you can see your plugin is implemented on the right side (populaer today).

    now my problem is, your plugin not working half of the day.it works on the next half onliny.this is the situation daily. what could be the problem?

  12. Pingback: iDESING
  13. Hi Andrew! i’ve been using this plug in, and i think it’s really good, but there’s just one thing I don’t like.
    When you are not logged in, and you refresh, it tracks everytime the hits, if you make a comment, it continues adding hits… i hope this could be fixed, may be tracking by ip’s or something like that. If anyone could help me i’d really appreciate it.

  14. Hi Andrew,

    Great plug-in, thanks you for your hard work! Please help with this issue I am having on my site…

    The visit count is grossly inflated. If I leave a post for a day without doing anything it shows between 60 and 66 visits. I have the tracking code copied on my home page post excerpts as well as the main post when clicked.

    Please help!? If anyone can help I would be most thanksful! 🙂

    I notice Almaz posted a similar finding (see below).

    Thanks,
    Shayne.

    Almaz Says:
    January 18th, 2010 at 9:37 am

    When you are not logged in, and you refresh, it tracks everytime the hits, if you make a comment, it continues adding hits… i hope this could be fixed, may be tracking by ip’s or something like that.

  15. from my experience it does not work nicely with caching plugins. page views remain very less with cached pages as the content is picked from a static html file and the number does not increase.

    also, there is no option to reset the page views 😀

  16. thanks for the plugin. is there any way to “ignore” a specific entry? I have this off-topic entry that keeps showing as top but it is masking the other on topic ones.

    ceo

Leave a comment

Your email address will not be published. Required fields are marked *