post-page

Top 10 Posts/Views

87
responses
by
 
on
March 14th, 2005
in
WordPress Plugins

For quite some time now, Mark has had some PHP code snippets just hanging around here on the site. Feeling the need to create a plugin for it and cite the documentation a little better, I did so. You may now find the, once what was just code, plugin Top 10 Posts/Views.

This plugin functions as a means to showing your top 10 posts (sorted by number of views) and displaying the total number of views on a per post basis. I have seen many sites use this code and now it is a plugin for all to use.

Update on 04/08/05: I have updated this script with better documentation and easier use of the script. Please note the documentation in the script itself at the top and you may refer to this page I have created to show some examples of the code.

heading
87
Responses

 

Comments

  1. theMike (3 comments.) says:

    Ok, I’ve uploaded and activated the plugin, and am a little lost on what to do next. Any help is appreciated. Thanks. BTW, I noticed you linking to BrowseHappy.org, did you have anything to do with that site? I was one of the interviewees and my story is still there.

  2. Jonathan (12 comments.) says:

    If you view the actual plugin, it has instructions in the file itself. I may re-upload the file with 2 files. So just download it again and view it to see how to use it.

  3. bingu says:

    It really a plugin what I want!!

    I use the pool Theme,and i can’t find this code in my index.php

    How to?

  4. kilikina (5 comments.) says:

    I can’t get it to work either. I’m using 1.5 and basically copied the default theme over to the theme directory that the install created, and used my stylesheet from 1.2

    I’m guessing the line:
    0) { add_count($p);}?> goes into single.php but nothing posts to the mostAccessed table. I’ve tried moving the line to about 4 or 5 different places and still nothing happened :(

  5. kilikina (5 comments.) says:

    hrmm… ok after fiddling for a little I found where it goes. In the default wp 1.5 template it would go right before the line that says:

    the only problem now is with permalinks the url isn’t calling ?p=postnumber so the postnumber is passing as 0. the statement checks for that so nothing goes to the database =\

    If i go to mydomain.com/?p=399
    it works

    If i go to mydomain.com/archives/2005/03/13/postname/
    it doesnt work :(

    Is there any way to fix that?

  6. kilikina (5 comments.) says:

    I got it :P
    replaced $p with $id and it worked

  7. Jens (6 comments.) says:

    Hi

    I also have some problems with this one, first I cannot find the line you are refering to, I added it inside the loop but it does not seem to add any data to the db. When running the webpage I get an error

    Warning: Invalid argument supplied for
    foreach() in …\plugins\top10.php on line 67

    Thanks for any help.

  8. Jonathan (12 comments.) says:

    Sorry about the mix-up then. I’ll make an update to it with corrections. It works fine under my other blogs, not sure why it’s not working here. Thanks for reporting it.

  9. Jens (6 comments.) says:

    Jonathan: Thanks
    kilikina: On what line did you put it?

  10. kilikina (5 comments.) says:

    oh lol… guess it got funked up by the php tags =\
    it goes in single.php right on top of :

    <?php endwhile; else: ?>

    <p> <?php _e(‘Sorry, no posts matched your criteria.’); ?> </p>

  11. Podz says:

    I just got it working from this plugin, having used the hack for a while.
    Couple of issues:

    Compare what I have below with what is in the plugin and make the changes. This preserves code validity.

    //$url = get_permalink($post->ID);
    echo “<li><a href=”$siteurl”.”index.php?p=”.$post->ID.”&more=1&c=1″ title=”$text”
    >$post_title</a>  <strong>($result->cntaccess)</strong></li>”;
    }
    }

  12. Jens (6 comments.) says:

    Hi, I now got it up & running, working great after the help from Podz.I do have a request. Could it be possible to write out the url rewrite urls instead of the p=x version somehow? It is just because of my stats, it will now as it is look like two different urls.

    Is it possible?

    Here is how it looks now http://jedisthlm.com/

    And thanks again for a great plugin.

  13. Jonathan (12 comments.) says:

    I will try to make the update today with those things. I’m not sure if I will be able to make it using the permalinks instead, but I’ll see what I can do.

  14. kilikina (5 comments.) says:

    to get the permanant links to work:

    replace these lines:
    //$url = get_permalink($post->ID);
    echo “<li><a href=\”$siteurl”.”index.php?p=”.$post->ID.”&more=1&c=1\” title=\”$text\” />$post_title</a>  <strong>($result->cntaccess)</strong></li><br/>”;

    with:
    $siteurl = get_permalink($post->ID);
    echo “<li><a href=\”$siteurl\” title=\”$text\” />$post_title</a>  <strong>($result->cntaccess)</strong></li><br/>”;

  15. Jonathan (12 comments.) says:

    I’m actually still running into the problem of the foreach not working on line 67 for pop posts. Anyone find a fix for that? I tried to debug it, but couldn’t hack it yet. I’ll keep playing with it, but thoughts on it?

  16. Jonathan (12 comments.) says:

    Bah, I’ve run out of time. I’m leaving the country for a little over a week and won’t have time to make the update quite yet. If anyone feels like they want to make all the changes needed and e-mail it to me, I will update the file on hand for people to download.

    You can e-mail it to: yeahmmhmm@gmail.com — Hope everyone enjoys this plugin once it’s updated.

  17. Poonam (3 comments.) says:

    Are there any new updates on the directions to use this plugin?? Please let me know

  18. Jonathan (12 comments.) says:

    Okay, I’m going to make an update to this script this weekend with the corrected code. Finally tweak it so it works just fine now. Give me a couple days and it will be updated for everyone to use :)

  19. Kahsoon (1 comments.) says:

    very nice!

  20. Foto-ZZoom (1 comments.) says:

    i will use this for our malaysia camera blog – http://www.fotozzoom.com.my/wp/index.php

  21. Steve says:

    Is it possible to modify this to only show the top 10 posts of a given category?

  22. Jonathan (83 comments.) says:

    No, sorry, that has not been coded nor is in the plan to do so. That would a lot more coding and plugin would be very extensive instead of the short and sweet plugin it is right now. But you are more than welcome to try to modify it yourself to try to get it to work.

  23. yuri (1 comments.) says:

    is there a way to exclude an ip or a user from the top10 count?
    so that the database doesn’t get updated for a certain ip or user?

  24. Jonathan (83 comments.) says:

    There is nothing in the plans right now for that, it’s an as-is product and doesn’t have much or any development plans. You can try to code it in yourself though, if you wish. I simply ported it over to a plugin from which Laughing Lizard made, you may want to contact him about it.

  25. Ray (5 comments.) says:

    Thanks, I used this on my site. It’s exactly what I as looking for.

  26. Steve says:

    I got around the problem of showing only a specific category by having a custom single.php for the category, and only having the plugin counter for that index. :)

  27. Ray (5 comments.) says:

    I found a way to cut the queries down from 11 to 1, I e-mailed the author so he can update the code, and I posted a comment for it on my site: http://raybdbomb.com/05.31.200.....omment-964

  28. prattflora (1 comments.) says:

    Thank Jonathan to create this plug-in. It is useful! I am wondering where can I put a code and show up the total visited amount of my blog? Is it possible? thanks!

  29. Jonathan (83 comments.) says:

    Do you mean the total visiter to your blog or the total visiter on a per post basis? Right now it works fine on a per post basis, that’s how I have my site setup. http://www.bleakgeek.com if you wish to take a look. Let me know how it goes : )

  30. Ray (5 comments.) says:

    One major problem I see with this plugin is that one use can keep refreshing on the post and have the view count just keep going up.

    I make a workaround for this; if a user has seen that post, it won’t increment it again. I.e. it has turned into “view per post” to “view per post per user” sort of thing.

    See my post for info on how to edit it, or if the author would like to add it to his plugin.

  31. Tim Yang (2 comments.) says:

    Jonathan, how do I create a list of the most viewed posts?

  32. Jonathan (83 comments.) says:

    Follow the instructions that come with the plugin and it tells you how.

  33. Mark (118 comments.) says:

    test

  34. Mark (118 comments.) says:

    Another test

  35. selim (1 comments.) says:

    the most important plugin for wordpress
    thanks

  36. Matty says:

    Hi,

    im using this plugin and I was wondering,It counts the views to every single page on my site and displays them in the top list,including the contact us section about ect… is there any way to filter the pages you want it to count?

  37. Matty says:

    Anyays to filter the pages you want counted?

  38. xavy (1 comments.) says:

    It adds two points per visit in my blog! how can it be possible
    I have checked and i only have add_count once

  39. raaja says:

    i cant find

    in my index.. im using wordpress 2.1

  40. J says:

    For wordpress 2.1 onwards, add these codes

    no permalinks:
    0) { add_count($p);}?>

    using permalinks:
    0) { add_count($id);} ?>

    in single.php of your themes folder, under

    Hope this helps.

  41. Babak (1 comments.) says:

    Is there a way to set it to a different number than 10? say, 15 or 20?
    Thanks.

  42. php noob says:

    how to add table using phpadmin?



Trackbacks/Pingbacks

  1. Top 10 Posts/Views

    自己成功装了第一个(以前安装过一些,没成功0_o!!)wordpress plugin-Top 10 Posts/Views,其实,WordPressçš„Plugin是很容易安装的,只要把Pluin放到特定的目录下,在后台激活就搞定的了.但这个Plugin需要改…

  2. [...] Stats Depokerizer Acronym Replacer AutoLinker Blacklist Blogtimes Comment Quicktags Top 10 WP Grins WordPress M [...]

  3. [...] ordpress: How to Install Post View Count/Top 10 Plugin

    I just installed this Top 10 Posts/Views Plugin by Laughing Lizard. It did take a little poking ar [...]

  4. [...] er Acronym Replacer AutoLinker Blacklist Blogtimes Comment Quicktags Top 10 WP Grins Wordpress Mobile Edition WYSI-Wordpress Alternative Recen [...]

  5. [...] 0:51 pm WordPress plugin:Top 10 Posts/Views 今天裝上了WordPress的一個plugin:Top 10 Posts/Views,他利用多設置一個SQL的table來記錄文章被cli [...]

  6. WordPress Top10/View Count Plugin

    I released a ported version of Top10/View Count plugin about a month ago. I ported it over from the txt file that Laughing Lizzard had into a plugin so that it was easier to use. It had some bugs in it, so I decided to create some more documentation …

  7. [...]
    为装这个插件用了一下午的时间,来源是 [...]

  8. [...] dPress: Batch Categories Plugin WordPress: Top 10 Posts/Views Su Weblog Tools Collection è disponibile un plugin che mostra i 10 articoli pià [...]

  9. [...] reat ones are already there. A few which I’ve been sampling and delighting in are: Top 10: Basically allows you to count number of views for each post and displ [...]

  10. [...] itles, but not show the post titles (and links) by date. The second plugin I installed is Top 10 Posts/Views. When you come to a site like this one, or even a news si [...]

  11. [...] ess, WordPress Dev by Jonathan Friday April 8, 2005 I released a ported version of Top10/View Count plugin about a month ago. I ported it over from the txt fil [...]

  12. [...] log tweaks here and there whole week… Page Views – I was finally able to make the Top10 to work with the rest of the other plugins. Entries now have pageview c [...]

  13. SELaplana says:

    Top Ten Posts and Views Problem

    Recently, the plugin Top Ten Posts/Views installed on my WordPress system is running good. My recent version of the WordPress is version 2.0.1.
    However, after upgrading my system to WordPress version 2.0.2, I noticed that these plugin stops recording t…

  14. [...] Top viewed posts plugin Another powerful method you can do is to install the top views plugin. This plugin can display the most popular posts in your blog, thus attracting more readers and improve your pageviews. I think you can change the default number to display, I usually will display the top 15 most viewed posts. [...]

  15. [...] Weblog Tools Collection – Top 10 Posts and Views WordPress Plugin on your Blog [...]

  16. [...] Install these SEO-friendly WP plugins — Optimal Title, Related Posts, Simple Tags, Ultimate Tag Warrior, Permalinks Redirect, Google Sitemaps, Top10, Get Recent Comments, Add Meta Tags. [...]

  17. [...] Top 10 posts – Looks like a promising little tool, for both content management and news portals. [...]

  18. [...] Cria um google sitemap do seu site. O site map é um arquivo xml que diz quais páginas fazem parte do seu site. Assim, facilita a vida do Google a rastrear seu site. Muito bom. (SEO optimization) Top 10 [...]

  19. [...] AdSense-Deluxe -an easy way to organize google ads. CG-SameCat -generates a list of pages in the same category. Category Order -customize the order and hierarchy of categories. WP-EMail -email posts to a friend. Feedburner Feed Replacement -directs RSS feeds to feedburner. Google Sitemaps -creates a Google-friendly sitemap. Bookmark Me -those multi-colored links you see everywhere. Tags in the Head -a way customize meta tags Top 10 Posts -counts post views and lists the top 10. Underscore Permalinks -uses _ instead of – in permalinks. Ultimate Tag Warrior -organizes tags for each post. Random Quotes -those random phrases just below the header. Contact Form -a simple contact form. [...]

  20. [...] Hoje resolvi colocar a mão na massa e migrei os dados gerados pelo plugin Top 10 e passei a usar o plugin WP-PostViews. Eu estava pensando em fazer esta mudança já tem algum tempo, mas ficava me torturando que os dados não poderiam ser reaproveitados. Hoje, com toda a calma que um feriado enforcado pode me dar, coloquei a mufa para funcionar e migrei. Foi supersimples. Para você não muda nada, mas para mim, melhora a estatística e controle sobre atualizações de versão. [...]

  21. [...] Top 10 Posts – gives you the top 10 posts by views, very hackable see my top 100 posts for an example.  [...]

  22. [...] AdSense-Deluxe -an easy way to organize google ads. CG-SameCat -generates a list of pages in the same category. Category Order -customize the order and hierarchy of categories. WP-EMail -email posts to a friend. Feedburner Feed Replacement -directs RSS feeds to feedburner. Google Sitemaps -creates a Google-friendly sitemap. Bookmark Me -those multi-colored links you see everywhere. Tags in the Head -a way customize meta tags Top 10 Posts -counts post views and lists the top 10. Underscore Permalinks -uses _ instead of – in permalinks. Ultimate Tag Warrior -organizes tags for each post. Random Quotes -those random phrases just below the header. Contact Form -a simple contact form. Get Recent Comments -displays recent comments in the sidebar Kramer -displays recent inbound links in the sidebar [...]

  23. [...] with WordPress 2.0 and 2.1. 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, once again, [...]

  24. [...] to a tip from podz, I installed Top 10 Posts/Views plugin. This gave me the functionality of showing view count for each post, and showing the 10 most [...]

  25. [...] Top 10 Post/Views it shows how many times posts have been viewed. (Sorted by number of viewed) [...]

  26. [...] there’s the Top Ten Plugin, from Californian Johnathan, who’s got tons of other WordPress stuff as [...]

  27. [...] Top 10 Posts – gives you the top 10 posts by views, very hackable see my top 100 posts for an example. [...]

  28. [...] with WordPress 2.0-2.2. 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, once again, [...]

  29. [...] ???????? ?? ??? ??? ??? ??? ??? ???? ???? ?? ??? ?? ??? ??? ??? ??? ?? ???? ?? ???? ?? ?????? ?? ?? ?? ?? ????? ???? ???? ??? [...]

  30. [...] Top 10 Posts – Another one of the WordPress navigation plugins, this plugin will help to reinforce linking to your best pages. [...]

  31. [...] viewed posts pluginAnother powerful method you can do is to install the top views plugin. This plugin can display the most popular posts in your blog, thus attracting more readers and [...]

  32. [...] Top 10 Posts – gives you the top 10 posts by views, very hackable see my top 100 posts for an example. [...]

  33. [...] Especially nice if you’ve upgraded to flickr pro and have multiple albums, see an example. Top 10 Posts – gives you the top 10 posts by views, very hackable see my top 100 posts for an example. WP Cron – [...]

  34. [...] Cria um google sitemap do seu site. O site map é um arquivo xml que diz quais páginas fazem parte do seu site. Assim, facilita a vida do Google a rastrear seu site. Muito bom. (SEO optimization) Top 10 [...]

  35. [...] powerful method you can do is to install the top views plugin. This plugin can display the most popular posts in your blog, thus attracting more readers and [...]

  36. [...] powerful method you can do is to install the top views plugin. This plugin can display the most popular posts in your blog, thus attracting more readers and [...]

Obviously Powered by WordPress. © 2003-2013

page counter
css.php