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!
Will the plugin work in 2.7?
@michael: sorry about that. I’ll release a fix soon.
@verter: I’ve been told that an error related to the plugin occurs while you upgrade. But after that it works normally.
I’m getting the same error in WordPress 2.7 as Patrick:
How do I fix this?
Hi Brodie and Patrick, the error has been fixed.
Great plugin, I’m using it here:
http://www.holster.co.uk/blog
I’ve already gone through the code and set it to only show 5 posts instead of 10, but how can I remove the ‘3 views’ from after each post title?
Perhaps the plugin deserves an admin panel where these settings can be tweaked…?
Great work though, thanks very much, this was the only popular posts plugin I could find which worked straightaway…
®
@SINDRE: Why not put the actual call for the plugin (the bit that displays the view numbers and actualy tracks the post) into some sort of ‘if’ statement, so it is only executed on a post within your chosen category? That way you can get the desired result without any modifications to the plugin itself…
®
Can you show the Top Posts for Today outside of the sidebar?
Todays_count_widget always show the “not post viewed yet” message when used in other templates 🙁
Hi! Good day! Congrats for winning the 2008 Philippine Blog Awards.
I am Gwyn, a student from the University of the Philippines – Diliman. I, together with my partner, Roxanne Flora, is writing a thesis on blogging ethics.
We chose the winners of the 2008 PBA as the respondents for our thesis. Can we ask for your help by being one of the online interviewees? We hope to hear from you soon.Thank you so much.
Respectfully,
Gwyn Ann Marie S. Ebol
Hi Gwyn, sure! You may contact me through my email address: andrew {at} alleba.com.
Nice plugin, but is there a way of not showing the view count?
@Rick, yes. In instruction #1, change ‘show’ to ‘noshow’ to hide the counter.
@Andrew: Thanks for the info, but each post’s count is still showing up in the sidebar.
This plugin came recommended so I’m here to give it a try. Keep up the good work.
Thank you so much. We will forward the questions within this week.
More power to you!
-Gwyn
Hi there,
Thanks for this great plugin. I’m using it on my site, although I’m currently going through the source code to try and set it to only show the top five in the overall visits widget. (Easier said than done given that I don’t know PHP!)
Hi Andrew
I’m having the same problem as Rick Rottman.
ID, ‘noshow’, ‘noshow’, ‘noshow’, ‘noshow’, ‘noshow’); } ?>
Placing ‘noshow’ or even ” doesn’t have an affect on removing the view counts.
I don’t know PHP, so I don’t have a clue as to what more I could do to remove the numbers from the list of post titles.
Hi Lea, replace ONLY ‘show’ with ‘noshow’. Replacing all values with noshow will not work.
Hi Andrew
I’m sorry, but I’m back 🙁
Replacing ‘show’ with ‘noshow’ didn’t remove the counts from view on the widget either.
Today I found a error when I when to a page on my site. I’m wondering if someone else encountered this:
Warning: Missing argument 6 for todays_overall_count() in /home/oceanofp/public_html/wp-content/plugins/daily-top-10-posts/dailytop10.php on line 251
visited 3 times, 3 so far today
This is what is on dailytop10.php line 251:
function todays_overall_count($postnum, $visited, $times, $sofar, $unique, $show) {
I tried changing it to:
function todays_overall_count($postnum, $visited, $times, $sofar, $unique, $noshow) {
to match the ‘noshow’ I have in my single.php, but I got the same error after emptying my browser cache and refreshing the page.
I really like the concept of your plugin and would like to get it to work properly on my site, especially for using the widget for today’s top posts.
@Lea: The correct code is:
< ?php if (function_exists('todays_overall_count')) { todays_overall_count($post->ID, ‘Visited’, ‘times’, ‘so far today’, ‘0’, ‘noshow’); } ?>
as opposed to
< ?php if (function_exists('todays_overall_count')) { todays_overall_count($post->ID, ‘noshow’, ‘noshow’, ‘noshow’, ‘noshow’, ‘noshow’); } ?>
where strangely you changed all variables to ‘noshow’.
Hi Andrew
Yes, I had corrected the ‘noshow’ I had placed throughout the code after your first reply. I saw the error when I went to my site after correcting my alterations in the code.
I see that you have an update for the plugin, so I’ll update it and see if that works. Sounds like you made some allowances in it for code illiterates such as myself 🙂
Thank you for taking the time to respond quickly to my questions. Have a great weekend!
is it posible to exclude categories from the top 10 ?
I put code on single so posts in all cats are counted
but some of the cats on my site are reference and should not be in the top10 list even if they are popular
thank you
moo
maybe add to new version
we were hoping that the new version will allow tracking for single sessions only but still as the previous versions, changin 0 to 1 is not working..whenever the page is refreshed the counter increases.
hi..i have been lurking in your blog..very informative
Hello,
nice plugin, helped me a lot!
I have one problem maybe can be fixed. On one page i want to query post based on views. Want to show like 9 mostviewed posts, i’m already using this plugin ssuccesfully but want to add query_string before the loop so in that way i can use my loop design.
I hope this is possible,
thanks for answer!
what if I just want to post the total no. of views and not the daily ones? how do I change the code.
thanks
Dear Andrew,
Today I installed your plugin.
I would like to show a list from the most viewed posts.
I use WP6.3 so I installed the daily top 10-4
I inserted the following code into the page (at the bottom of the page – you can see: “Legnépszerübb”:
Legnépszerűbb
I was click to some post but only:
“No posts viewed yet.” shown.
What would be the problem?
Many thanks, Imre
Ahhhh the code was missing:
{
Legnépszerűbb
}
So it is not working.(maybe this way)
Thanks for the plugin. I used it on one of my blogs and I did not know it is from a Filipino.
I would love to see if you can add “yesterday” and “this week” stats as well so people can see the trending of the visits.
Thanks again!
游æˆå¿«æŠ¥æ˜¯ä¸“业网络游æˆç«™ç‚¹æä¾›ä¸šç•Œæ–°é—»/èµ„è®¯ï¼Œæ–°æ¸¸ï¼Œæ¸¸æˆæ”»ç•¥ï¼Œç½‘络游æˆäº§ä¸šç‰ä¿¡æ¯çš„网络游æˆç½‘站;是一家专业从事信æ¯å’Œå•†åŠ¡æœåŠ¡çš„ç½‘ç»œæ¸¸æˆé—¨æˆ·ç½‘ç«™ï¼Œå…¨é¢æ•´åˆæ¸¸æˆå¼€å‘å•†ã€æ¸¸æˆè¿è¥å•†ã€é”€å”®æ¸ é“ã€ç½‘å§ã€çŽ©å®¶ç»„ç»‡ç‰å„ç§èµ„æºï¼Œå…³æ³¨ç½‘络游æˆäº§ä¸šçš„æ¯ä¸€ä¸ªç»†èŠ‚ï¼
Hi there. I’m using your plugin on my site and I’ve found it to be excellent. I have 2 suggestions which would make it more useful for me:
1. Could there be a proper admin panel in the WordPress backend where some of the options could be easily set without the need to hard edit the plugin file? Specifically the number of posts listed.
2. Could there be an option to completely omit the ‘x views’ part of the output so it is simply an ordered list of posts without revealing view totals?
Every time I upgrade the plugin I have to make these changes manually to the plugin file at the moment, which as I have completely forgotten it from the last time, is a bit of a chore each time.
Thanks for all your hard work, it’s a great plugin.
hello – i’d like to sort the main list of posts by most viewed – how would i do this with your plugin?
Great plugin, i’m wondering if it will work with WordPress MU?
I installed the plugin in the /mu-plugin/ directory and it showed up in the widget admin panel. However it displays “No posts viewed yet.” But i clicked several times on some article links. Do i have to wait a day, until the plugin starts to work?
Hi, Andrew
Can it ignore registered user(i.e. adminstrator) view count?
Can u make a option/code for displaying the most popular posts for a particular category…
like i have to display most popular post of 1 category on one page and on some other page i want most popular post of other category..
Hey – Love the plugin! but is there a way to not display the (xx views) after the post name at all? So it literally just shows the postname per line and that’s it?
Thanks!
Hi, love the plugin! I’m wondering, though, if there’s a way to have it not display anything after the postname. So not have any reference to number of views at all? Thanks for the help!