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 wanted to find a way to make the top 10 daily only count recent posts. I found this solution, thought I’d share it in case anybody else is trying to do the same thing.

    10) : ?>

  2. Hi, i have this in my sidebar, showing a number or 10 entries, is it possible to have more entries to show? i would like the list to be long, lets say about 20 or 30 entries showing as “top 50” or whatever, where can i change the setting for this?

  3. Thanks for the plugin.

    Incase anyone is interested, I have this running okay on a 2.3.3 install.

    Will be testing it on a 2.5 shortly.

  4. This is a fantastic plugin. I am trying to get it to jive with the look in my archives. Is there any way I can have the todays_overall_count_widget to display with a simple “br/” function instead of a “ul” or “ol”?

    I tried tweaking the code with my limited knowledge but couldn’t quite hack it.

  5. Very nice plugin, i added this to my site and it works perfectly, really easy to modify as well. Good work m8!

  6. I do not have the single.php file in my theme? I only want to display the most popular posts, on my blog. Will this work without installing the code in the single.php file which I do not have on my theme.

  7. I get the “No posts viewed yet” message after installing the plugin to the sidebar, to view the “Top 10 Posts” of the day. I do not have the single.php page, so obviously did not install the code into there? Is that code needed for the sidebar widgets to work?

  8. I love this idea!, and I have it up and running. The problem I’m seeing is that the counts don’t agree with my “Blog Stats” from WP. What time do your counts start? Do they go for a 24 hour period? Could you tell us a little more about it? Is there a way to increase or decrease the number of items listed?

    Thanks, again, for a great plugin!
    Lisa

  9. Is there anyway to have the links contain rel=”nofollow” so that on other pages of the site the pages will only be returning page rank to the front page and not to all the pages on the “top posts” pages?

  10. 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?

    Thanks

  11. Hi,

    Thanks for a great plugin.

    But I have one problem.
    The number of views i.e. (XXX views) are not showing up in the sidebar. The title is there though.
    What can I have done wrong?

    Cheers

  12. when setting the unique views on single.php to yes it’s not working. still whenever i refresh the page the counter increases. I am using wordpress 2.5.1. is there any fix for that?

  13. Love the plugin, but I’m wondering if there is a way to hide the views count in the “top posts overall” sidebar section?

  14. Really great Plugin, thank you.

    Is there a possibility not to show posts of a special category in the top-ten-list?

    Thanks
    Rita

  15. Is there any way you will fix the dailytop10 plugin ( which I LOVE!!!) to work with WordPress 2.6 ?
    I am miserable without it working on a blog I upgraded.
    If I could roll back to 2.5 i would n a heartbeat just so your plugin will work.
    The problem is that it “breaks” the dashboard. and shows nothing after ” Today’s Top 10 Posts” header.
    Thanks!

  16. I’m using wordpress 2.61 and it totally doesn’t show up at all… i saw your note to make sure we downloaded the newest version, but you put no link as to where..

  17. Hi y’all, please check the 0.4 update. Hopefully all the bugs brought up have been solved.

Leave a comment

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