Popularity Contest Couldn’t Be Activated? Get Fixed!

Displaying your most popular posts is an excellent way to draw your readers into your blog to other posts proven to be enjoyed by other readers.

And with WordPress, it seems like there are two primary ways to determine which posts should be considered popular: the number of hits that they get or the number of comments that they get.

Some plugins list the posts which are commended upon the most. Others keep track of visits (or tie in to a stats plugin) to determine the most popular.

While those ways are good, they each only take into account part of the picture; after all, is not a post’s popularity determined both by comments & visits?

Enter Popularity Contest, a wonderful little WordPress plugin which — through plenty of mathematical voodoo — tracks a page’s popularity based on direct visits, views on the home page or within an archive, views in a feed, and comments, TrackBacks, and PingBacks.

Unfortunately, using Popularity Contest on more recent versions of WordPress has been made a bit more difficult by the fact that the two are incompatible.

When activating Popularity Contest here, I was met with a very unhelpful message about the plugin not being able to be activated due to a fatal error.

A couple of modifications to the Popularity Contest 1.3b3 file had to be made to get it to work. You can download the modified Popularity Contest file if you would like, or you can make the changes yourself.

If you prefer to download the plugin file from Alex King’s site, you’ll need to make these modifications to it using a basic text or code editor (not a rich text editor):

  • Find:
    require('../../wp-blog-header.php');
  • Replace with:
    @require('../wp-blog-header.php');
  • Find:
    if (isset($_GET['activate']) && $_GET['activate'] == 'true') {

  • Replace with:
    if (isset($_GET['action']) && $_GET['action'] == 'activate') {

After saving the modified popularity_contest.php file (or extracting the file from the archive you downloaded from here), upload it to your wp-content/plugins/ folder and activate it in the Plugins panel of your blog.

Works like a treat, no?

5 thoughts on “Popularity Contest Couldn’t Be Activated? Get Fixed!”

  1. Rick, You are truly a mastermind. I was trying to add to my sidbar based on the code givin in the plugin, All I seem to get is a error, this is the code I was using,

    Most Popular Posts

    akpc_most_popular_in_cat($limit = 10, $before = , $after = , $cat_ID = current category)

    Any Ideas?

  2. Mike: I think what you need to do is something more like this:

    akpc_most_popular_in_cat(10);

    The parameters listed in the example code need to be replaced with your variables for them; in this case, unless you want to modify any of them, you can leave it at just 10. Actually, you probably don’t even need that.

Leave a Comment

Your email address will not be published. Required fields are marked *

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

the Rick Beckman archive
Scroll to Top