ArticlesForumDownload AboutContact

boakes.org

nice of you to drop by. tea?

Tags: Releases, WordPress

MostWanted - a Popular Posts Plugin for WordPress

November 24th, 2004, by Rich.


Warning: apache_lookup_uri() [function.apache-lookup-uri]: Unable to include '/pics/2005/mostwanted/mostwanted' - error finding URI in /home/www/boakes.org/htdocs/mods/plugins/boakes-depicticon.php on line 65
MostWanted - a Popular Posts Plugin for WordPress

This WordPress Plugin which lists the most popular posts in a blog, according to the records held by StatTraq

MostWanted lists the most popular posts on a wordpress powered weblog. This list can be used in the sidebar to provided visitors with an indication of what are the most visited pages.

The MostWanted plugin in use.It’s grown a little since it’s original release so it has a subtle API change. Where previously it was called “rjb_mostwanted”, it is now “MostWanted::mostwanted”. Currently there is a wrapper around the old method name so that it still works, however this will be removed in future releases.

Installation

  1. Download this fileDownload this file
  2. Rename it mostwanted.php and copy it to your /wp-content/plugins folder.
  3. using wp-admin, enable the plugin

Usage

The plugin provides one method of interest: MostWanted::mostwanted($top_n, $trim_chars, $showviews). The three parameters are:

  1. $top_n
    the number of results to list default = 5
  2. $curtail
    0 for no text curtailment, or ‘n’ the number of characters from each post title that shoudl be displayed. e.g. Curtailing “My Dynamic Badger” to 10 characters would read “My Dyna…”.
    default = no curtailment
  3. $showviews
    true if the number of times each post has been viewed should be included in the list.
    default = false
  4. $show_views_in_tt
    TT is short for ToolTip setting this value to true includes the number of views as part of the tool tip. i.e. if you hover over the text the (1234 distinct viewers) message is shown.
    default = true
  5. $duration
    restricts the duration of the query period so that only the last $duration days are considered when measuring popularity. e.g. a value of 30 would return the number of users only within the last 30 days. Leaving the value unset, or 0, results in the all-time results being returned.
    default = 0 (all-time)
  6. $pre
    this is a text string that is added to every line.
    default = <li>
  7. $post
    this is a text string that is added to every line.
    default = </li>
  8. $method
    there are two ways of identifying unique visitors, neither of which are perfect, the default is to recognize only unique IP addresses, which means that if several people from one company visit, then they may show as a single user. Alternatively, using the session_id is not perfect because some users refuse to set cookies.
    default = ip, alternative = session
  9. $as_percentage
    if set to true, then the number of hits for each page as a percentage of the site total is displayed instead of the hit count itself. This may be desirable if you want to show popularity without letting on how many hits you get for each story.
    default = false
  10. $timeout
    adjusts how long the most-wanted information is cached for before being replenished from the db. A value of 0 (zero) will result in fresh data being retrieved for every query, whereas a value of 3600 will only query the database once every hour, cacheing the output and thus reducing DB load.
    default = 1800

The simplest way to use the plugin is therefore to augment your page with:
<ul>
<?php MostWanted::mostwanted(); ?>
</ul>

A more tuned version might read:
<ul>
<?php MostWanted::mostwanted(7, 30, true); ?>
</ul>

License

MostWanted is released under a Creative Commons License.

Credits

If you find MostWanted useful, please feel free to link or a trackback to this entry.
Thanks to everyone whose commented with problems, solutions & suggestions, especially:

210 Responses to “MostWanted - a Popular Posts Plugin for WordPress”

Pages: «11112131415161718192021»

  1. 151
    L Says:

    I get the same error with your plugin now that I’m using that 1.5 version, and that one works.

    It’s good info, which I like anyway. Thanks for letting me know about it. If I don’t use your plugin, I can deal. Today, I set up a manual/static top pages thing that includes top images. So that’s extra special, if taking some work.

  2. 152
    Rodney Shupe Says:

    Chris,

    When you inialize the plugin with a “new” it calls the constructor which is named the same as the class. As a result you are calling the mostwanted() function twice.

    Aha - instead of calling MostWanted::mostwanted(); this seems to (mostly) work:

    $m = new MostWanted();
    m->mostwanted();

    the odd thing I get now is that although the widget is configured to only show the top 5 I actually get the top 5 repeated twice..

    Go figure! :-)

    cheers, Chris

  3. 153
    Everton Bliar Says:

    Hi

    I’ve got version 1.9 and WP 2.03 but I can’t get your script to work. Whenever I add the following to my sidebar:

    I get the following error

    Fatal error: Non-static method MostWanted::mostwanted() cannot be called statically in /home/connecte/public_html/wp-content/themes/ag/sidebar.php on line 45

    Can you help me fix this please? StatTraq is working ok so I don’t think this is the problem

  4. 154
    Trackback from: Listening Post » Blog Archive » links for 2006-06-08
  5. 155
    Trackback from: Unikram, Paper & Recherchen » Neue PlugIns, neue Sidebar, bessere Übersicht
  6. 156
    Trackback from: Call-151 » Blog Archive » WordPress 통계 Plugin - StatTraq
  7. 157
    Chris Samuel Says:

    Rodney wrote:

    When you inialize the plugin with a “new” it calls the constructor which is named the same as the class. As a result you are calling the mostwanted() function twice.

    That was is! Trivial patch and it appears correctly again.

    Emailing the file to Rich now after merging his validation fix.

    cheers!
    Chris

  8. 158
    Bregutz Says:

    I have instaled the plugin on http://www.curaj.net (see the bottom of the sidebar) but instead of showing the rating of a post it shows “???” what that measn!? Can u pls help me? I also would like to ad some dots after a post title wich is not comple, how do i do it!?

  9. 159
    Trackback from: Unikram, Paper, Recherchen & Software » Meist gelesene Beiträge nun einsehbar
  10. 160
    Moneyman Says:

    hi the plugin is generating errors. “p_1.wp_stattraq’ doesnt exist”

Pages: «11112131415161718192021»