How To: Fixing Popularity Contest Plugin for WordPress 2.5

The problem(s): With some upgrades of the WordPress 2.5 branch, the Popularity Contest WordPress plugin is not working properly. Also, people trying to activate the Popularity Contest plugin on a brand new WordPress install are getting a fatal error or a “doesn’t exist” message when attempting to activate the plugin.

The solution(s): I actually ran into this problem on a fresh install of WordPress. After several attempts, I was unable to figure out the problem myself. Thankfully, a quick Google search showed a post over at WPGuy which gave details on fixing both problems!

Here is what you need to know if you have this problem:

Fix problems with the upgrade to WordPress 2.5

Open your Popularity Contest plugin (edit it) and search for this code:

require('../../wp-blog-header.php');

And replace it with this:

require('../wp-blog-header.php');

Fix problems with a new install of WordPress 2.5

In addition to doing the above, you need to search for the following code:

if (isset($_GET['activate']) && $_GET['activate'] == 'true') {

And replace it with this:

if (isset($_GET['action']) && $_GET['action'] == 'activate') {

I went through both of these steps on my fresh WordPress install and it fixed the problem perfectly!

  • Leave a Comment
  • Promote Your Popular Posts With Popularity Contest

    I’ve mentioned before that there are a lot of crucial WordPress plugins that all blogs should use; however, this one I’m going to talk about is not one of them. Instead, this plugin is a great plugin for certain types of blogs that have several anchor posts that are their claim to fame.

    This plugin is called Popularity Contest, and what is does it automatically monitor the traffic on your blog and displays a designated number of your most popular posts. This helps funnel new readers to the best and most popular work in the hopes of retaining them as a feed subscriber. It also has the additional benefit of showing a permanent link on every page of your blog’s sidebar, which will send a little search engine link juice to these posts and help emphasize them with search engine spiders.

    How do I set up this plugin? As with most plugins that involves the sidebar, you will have to manually insert some code in order to get it working properly. Once you’ve uploaded and activated Popularity Contest like normal, you’ll find that this plugin is pretty easy to set up. You’ll want to determine where you want your popular posts to be displayed in your sidebar and paste the following code:

    <?php if (( (is_home()) or (is_single()) or (is_page()) or (is_search() or (is_404()) or ($notfound == '1'))) && (function_exists('akpc_most_popular'))) { ?>
    <h2>My Popular Posts</h2>
    <ul><?php akpc_most_popular(); ?></ul> <?php } ?>
    <?php if ((is_archive() && is_month()) && (function_exists('akpc_most_popular_in_month'))) { ?>
    <h2>Most Popular Posts of <?php the_time('F Y'); ?></h2>
    <ul><?php akpc_most_popular_in_month(); ?></ul> <?php } ?>
    <?php if ((is_category()) && (function_exists('akpc_most_popular_in_cat'))) { ?>
    <h2>Most Popular Posts in '<?php single_cat_title(); ?>'</h2>
    <ul><?php akpc_most_popular_in_cat(); ?></ul>
    <?php } ?>

    If you use this code above, it will not only display your most popular posts in your sidebar, but it will actually add your individual categories most popular posts to that particular category, and display the most popular archive posts within your individual monthly archives. This will help improve navigation for readers digging through your blog’s categories and archives, in addition to your main pages.

  • Leave a Comment