WordPress widget : Most popular posts

I wanted a “Most popular post” section on my blog, but after some bad experiences with “Popularity Contest” (by Alex King) I decided to write my own. As I already had a statistical mechanism that provided me with the data (namely OWA), it was a no-brainer to write a small plugin that would use the data gathered by OWA. So after a bit of coding, a bit of testing, and polishing… it was done. You can find the script (with some installation help) here. If you have any feedback about it, let me know!

18 thoughts on “WordPress widget : Most popular posts

  1. Hey Karim –

    very cool plugin. The only piece I would change would be to use the OWA API for getting the top documents data. That way your plugin won’t break if the OWA schema changes over time (which it will).

    Here is some code to get you going:

    // OWA must be an active plugin for this to work
    global $owa;

    // API config values
    $owa_params = array();
    $owa_params['site_id'] = $owa->config['site_id']; // the current site id
    $owa_params['limit'] = '10'; // the number of top pages you want

    // API call for Top Pages
    $top_pages_data = $owa->api->getMetric('base.topPages', $owa_params);

    // Presentation code
    foreach ($top_pages_data as $k => $v) {
    ; // ad your presentation code here

    Hope that helps. Let me know if you run into any problems.

  2. Very cool. There are a few things I was looking for… Can you make the most popular list time-specific. Like the most popular posts over the past 7 days or whatever? Also, can you show a percentage showing the stories popularity compared to the sites total views that were tallied? I found another plugin that did this, but I couldn’t get it to work [Boakes MostWanted was the plugin, and it used StatTraq for stats].

  3. It is possible this thigns: I want make an experiment: What about every month deleting the most popular topic. It is possible to do that in this module?

  4. Maybe you also interested in one plugin that wraps the Popularity contest of Alex King and brings additional “Most Popular” Widget. I call it W-Popularity. It’s full compatible with Popularity contest.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.