post-page

WP Plugin: Top 10 posts and Views per post

67
responses
by
 
on
November 25th, 2005
in
WordPress Hack, WordPress Plugins
heading
heading
heading
67
Responses

 

Comments

  1. Katie (7 comments.) says:

    I’m getting this error: Warning: Invalid argument supplied for foreach() in /home/ktrame/public_html/wp/wp-content/plugins/top10.php on line 70

    I’ve clicked on a bunch of my entries and it’s still not working.

  2. Ozh (88 comments.) says:

    why not use the postmeta table instead of creating a new one ?

  3. Mark (118 comments.) says:

    To keep it backwards compatible with older versions and keep it from muddling with the WordPress datastructures.

  4. Sam (6 comments.) says:

    Yeah. That’s what i need. Thanks!

  5. Sam (6 comments.) says:

    Sorry. But it doesn’t work. The table doesn’t become updated. I clicked on some entries.
    I’m getting the same error like Katie.

  6. Mark (118 comments.) says:

    Sam and Katie, does the table get created? Do you get any errors on the single post view screen?

  7. Katie (7 comments.) says:

    I’m not exactly clear on where I should be looking for this table….

  8. Sam (6 comments.) says:

    Yes the table was created and i get errors in the single post view.
    There is no data in the table mostAccessed.

  9. Katie (7 comments.) says:

    Just checked phpMyAdmin and yes, the table is there but like Sam, there is no data. Errors in the single view as well.

  10. Katie (7 comments.) says:

    If this helps, I’m getting a warning sign saying “PRIMARY and INDEX keys should not both be set for column `postnumber`”

  11. kaufman (4 comments.) says:

    Hi Mark – I’m still getting the hang of wordpress internals, but it looks like you’re trying to add an action for “loop_start”, but it’s not obvious to me when that action is actually done. I can’t find “loop_start” in any of the WP code. Is it possible that that’s from WP2.0? I’m running 1.5.2

    Thanks!

  12. Mark (118 comments.) says:

    Kaufman, you are right. It looks like loop_start was only added in 2.0+ (which means my 1.5 test blog is fubar) I have made some changes to the plugin. Please check to see if this one works.

  13. kaufman (4 comments.) says:

    Works great now – many thanks!

  14. Sam (6 comments.) says:

    It works. Thanks. But i added an echo ''; after the output.

  15. Katie (7 comments.) says:

    It’s working now, thanks! Now, if only you could set it up to not count my own hits. :)

  16. Joseph says:

    Can someone please fully test these hacks that they are compatible, or better yet, compile a .php to apply them and if you have to just query the database.
    Everytime i go to a plug ins Blog i find nothing in comments but tons of errors. This is frustrating and not encouraging for advancing WP. Thanks

  17. Katie (7 comments.) says:

    Oh, also a suggestion, if you’re taking them… not having pages show up in the post count. I have my archives by date all on a separate page, and that page shows up as a popular post now.

  18. Nico (3 comments.) says:

    I agree with Katie. It would be great if the plugin didn’t show pages, only posts!

  19. Dave (1 comments.) says:

    Thanks for a fun and easy plug-in. I’m not much at PHP, but should there be a closing ul tag in the function show_pop_posts()?

  20. Mark (118 comments.) says:

    If you have ever written code, you should know that bugs are a part of life for us programmers. It is IMPOSSIBLE to “fully test” plugins since every blog is different, every bit of code is different and with the preponderance of a variety of different cooks in the broth, there are numerous versions of WordPress being used. Plugins are especially more vulnerable to naked errors since plugin authors do not have a ready set of beta testers who could point out possible errors. They just use their own test blogs to make sure that eveyrthing they can fix, is fixed before the initial release.

    I do not think that plugin bug reports are discouraging for WordPress, nor are they in any way damaging to the “advancing” of WordPress. I sincerely hope that you (and others like you) are not turned off by the fact that people report problems (which are then hopefully fixed) on new code.

  21. kaufman (4 comments.) says:

    Well said, Mark – as a programmer myself, I can only back you up on the fact that testing every possible permutation of systems is pretty much impossible.

    Folks, if you are not interested in helping to isolate and test those permutations, then please do NOT apply plugins or other code that is in any state of development. WP works great “out of the box” – if you want anything more than that, then you’ll have to accept the responsibility of living with “in-development” code.

  22. Katie (7 comments.) says:

    I’m getting some wacky things going on with my top 10 list. Some entries keep showing up on the list twice, even though it’s the same exact entry (same post ID and everything). Then I have one line that just says (2) with no title.

  23. Eric (5 comments.) says:

    I got the same problem as Katie. A post keep showing up randomly and in my case it is on number 1 of the list. The number of visits don’t change though, it’s just the post title.

  24. Eric (5 comments.) says:

    I kind of figure out the pattern of the error in my blog. The number 1 post showing up on my top 10 list is always the most bottom post on the front page. So if the post on the far bottom of my front page changed, it will become the number 1 on the list. Hm.

  25. Sam (6 comments.) says:

    Yes. I have the same error.
    While i am viewing a post, the post is the most viewed post in the list.

  26. Mark (118 comments.) says:

    Update plugin, please check. I have to run but will explain when I have a minute.

  27. Sam (6 comments.) says:

    Ok, now it works. But the tag is still missing…

  28. Paul Monaco (1 comments.) says:

    Is there an easy way to reset all the counts? I deleted some test posts but they still show up in Top 10 without subject and just the hit count showing? Still love this plug in!

  29. Vidar Glosimot (1 comments.) says:

    Hello, I got a probplem with the url the plugin creates. Normaly the top 10 list would write the list and then make you click the article to read it. Am I right? But on my page the url on each article in the top10 list is the url to the page I have the top10 list on. Check http://tilkoblet.net/blogg/?page_id=29 to see what I mean.
    How do I fix this?

  30. claus (1 comments.) says:

    Sorry for asking a stupid question but what exactly does the plugin count? I’m asking this because I’m currently comparing several statistical tools, and while the differences between the others (Measure Map, Mint, Google Analytics) are only minor, those of Top10 are enormous. E.g., according to the plugin, my most accessed post (with twice the amount of the post ranked at #2) is a rather obscure one that hardly gets noticed by the other tools. And most of the posts in my Top 10 still continue to grow exponentially (compared to the other posts) even though this includes some more or less “outdated” posts which according to the other tools aren’t visited at all anymore.

    How can this be? Does the access count also include search engine crawls and suchlike?

  31. tommy says:

    How about a “top 10 emailed”?

    Can you add a function to count the number of post emailed for those of us using WP Email?

  32. Max (1 comments.) says:

    Thanks a lot fot the plugin! I have a couple of questions though:
    1. Seams like counter functions does count bots, so the numbers of views grows very fast almost every minute. Can that be fixed?
    2. Is there a way to avoid rating pages? I see that pages I created in wordpress also in the Top 10 Posts.

  33. Nicolai (1 comments.) says:

    I see a number of comments mentioning that the plugin rates pages as well as post. I don’t know how to avoid the page rating but maybe there is a way to avoid listing certain pages.
    Wordpress has the abillity to “exclude” pages from lists. I can’t get it to work though.
    If anybody finds a solution please post it.

  34. thatedeguy (5 comments.) says:

    As far as the rating pages bit goes, it should be possible to exclude the pages with the is_page() function. I haven’t looked at the code yet, but it returns a boolean so you should be able to us an if then bit to filter out pages.

    Also, I just downloaded this plugin about 4 days ago and am getting the error where one post appears multiple times on the list. Is there a fix for that yet? Any ideas on what causes it, so I can tinker around with the plugin code?

    Thanks,

  35. thatedeguy (5 comments.) says:

    Ok, I believe I figured out the duplicate entries bit.

    Why it creates them I don’t know cause it shouldn’t, but if you want to eliminate them, the hack is to make the postID in the mostaccessed table a unique field. That way there can only be one instance of each id. You will have to delete any duplicates before you do this, so it might throw off your numbers for a while, but it will eliminate the duplicate issue from there on.

  36. koz (2 comments.) says:

    First, thanks for the time spent on developing a plugin for the comunity.

    Second, the question ;-) : is it possible…

    (i) to show more than 10 posts. Is it ok to change the number, only ?
    (ii) to show the complete lists of all posts with the number of times they have been viewed. This could be displayed on a page that only the author can see (a list of maybe 500 posts would be unappropriate to be seen by everybody). Or may be it is possible to have two functions : one to show the top10 and another one to show the top-wahteveryouwant ?

  37. Paul "TBBle" Hampson (1 comments.) says:

    I’ve just modified top10.php quickly to support sidebar widgets, for those so-inclined: http://www.tbble.net/wp/top10.phps.

  38. koz (2 comments.) says:

    Ok. Now I understand why you do not answer. Probably because it is quite explained in the file…

  39. richards1052@comcast.net (3 comments.) says:

    The blog linked above does not appear to display the Top 10 Posts plugin as the post says it does. Is it possible to see it in action on someone’s blog??

  40. richards1052@comcast.net (3 comments.) says:

    The blog linked above does not appear to display the Top 10 Posts plugin as the post says it does. Is it possible to see it in action on someone’s blog??

  41. richards1052@comcast.net (3 comments.) says:

    The blog linked above does not appear to display the Top 10 Posts plugin as the post says it does. Is it possible to see it in action on someone’s blog??

  42. Anne (1 comments.) says:

    Can you help me please…I couldnt’ find

    in my index.php

    What I have is this:

  43. Lokesh (1 comments.) says:

    Nice plugin. Great work.

  44. Jake (1 comments.) says:

    How do I fix the views. On my index page it only shows the views at the very bottom of the page.

    Can someone help me out please.

  45. patung (6 comments.) says:

    In the mostaccessed table in the db the data gets truncated, my last line is:

    `mostAccessed` (`accessedid`, `postnumber`, `cntaccess`) VALUES (211, 254, 1);

    that is without the “INSERT INTO” part. I’ve tried emptying the table and starting again but same thing happens.

  46. kral oyun (1 comments.) says:

    I got the same problem as Katie. A post keep showing up randomly and in my case it is on number 1 of the list. The number of visits don’t change though, it’s just the post title.

  47. Cive (1 comments.) says:

    Cheers – I’m looking to run a Poll on the top #10 or #20 plugins

  48. The One Like SE (1 comments.) says:

    I made ja(broken Japaneze) localized version:
    http://takumiya.s13.coreserver.jp/error500/?p=13

  49. Lee (1 comments.) says:

    I just put together a list of my own. Take a look! http://www.wuhangotyouall.com/.....plug-ins/I just put together a list of my own. Take a look! http://www.wuhangotyouall.com/.....-plug-ins/

  50. mac (1 comments.) says:

    thank you for this tip. This tool is still today a big help for us bloggers to analyse our best top 10 Posts.



Trackbacks/Pingbacks

  1. Comments bug fixed for Red Stripes theme

    I’m using the excellent ‘Red Stripes’ theme Tech Wench » WordPress » WP Theme: Red Stripes and I’m indebted to Rev Fry for finding the solution to the comments bug.
    In addition to that I have:

    sorted the adverts out a bit…

  2. […] As is evident from looking at the sidebar to the right of this text, I am using the ‘Top 10 posts and Views per post’ WP plugin by Mark Ghosh. I am very happy with the “viewer popularity” rating this plugin provides, but I have been a little annoyed with my own page views being included in the view counts. Due to Adsense concerns, I have disabled the post preview in the WP post editor. This means that I tend go back and forth between viewing and editing a post – something which would capsize the view count. […]

  3. […] Yesterday, I installed a great little plugin which tracks my top 10 viewed posts. Unsurprisingly, this gives me a greater sense of what posts people are visiting as well as providing a means for other people to see my more popular writings. […]

  4. […] Next up is the Top 10 Posts plugin. You can delete the tag for this one out of the sidebar.php file if you want — but it’s great for deep linking, so I don’t know why you’d want to be rid of it. […]

  5. […] I modified the Top 10 posts plugin (original version) to have a widget mode for the sidebar, and also to do everything in a plugins_loaded hook, since […]

  6. […] another plugin to display the most viewed articles (I haven’t tested it). Personally however, I prefer to highlight the posts with the most […]

  7. […] the near future, I also plan to add a Top 10 Articles list (tried this plugin but couldn’t get it to work as a widget); trim up the space between article text and […]

  8. […] maybe an RSS Aggregator, Digg Items Widget, Folding Categories Widget (to make navigation nicer), Top 10 Posts Widget, and […]

  9. […] posts module should continue to get better and keep your readers around even longer. Install the Top 10 Posts and Popularity Contest plugins if you are using WordPress. By doing so, WordPress will […]

  10. […] 22. Syntax Highlighter. 23. Screencast – Posting Events with WordPress. 24. WordPress Reports. 25. Top 10 posts and Views per post. 26. Mobile Phone optimized WordPress. 27. Wp Forum. (It has been brought to my attention that this […]

  11. […] 22. Syntax Highlighter. 23. Screencast – Posting Events with WordPress. 24. WordPress Reports. 25. Top 10 posts and Views per post. 26. Mobile Phone optimized WordPress. 27. Wp Forum. (It has been brought to my attention that this […]

  12. […] back in 2005, Mark released the Top 10 posts plugin that allowed you to track page views and display them on your blog post. You could also display a […]

  13. […] 22. Syntax Highlighter. 23. Screencast – Posting Events with WordPress. 24. WordPress Reports. 25. Top 10 posts and Views per post. 26. Mobile Phone optimized WordPress. 27. Wp Forum. (It has been brought to my attention that this […]

  14. […] 22. Syntax Highlighter. 23. Screencast – Posting Events with WordPress. 24. WordPress Reports. 25. Top 10 posts and Views per post. 26. Mobile Phone optimized WordPress. 27. Wp Forum. (It has been brought to my attention that this […]

  15. […] Related Posts and Moderation Author Notify. Have spent almost the whole of this week rewriting Mark’s original Top 10 plugin. And, that sure has been a rather interesting, frustrating and of course fulfilling journey in PHP […]

Obviously Powered by WordPress. © 2003-2013

page counter
css.php