Support » Plugins » Modify “Popularity Contest” plugin

  • I am using the “Popularity Contest” plugin along with the “Exclude Pages from Navigation” plugin. Both are working well, as designed.

    However, the popularity contest measures and displays pages in it that I have designated to be omitted from the navigation through the exclude from navigation plugin.

    Can someone instruct me on a way to remove either specific pages, or groups of pages from display by the popularity contest functions?

    Thanks in advance,
    Kirk Ward

Viewing 4 replies - 1 through 4 (of 4 total)
  • I’ve been looking for an answer to this, too. :/

    Zack Katz


    You need to edit popularity-contest.php like this:

    Around line 1383, there is the following code:

    WHERE post_status = 'publish'

    add AFTER it:

    AND post_type = 'post'

    It should look like this in the end:

    WHERE post_status = 'publish'
    AND post_type = 'post'
    AND post_date < NOW()

    Hacking on the plugin code isn’t a particularly good idea (for instance, when you upgrade you have to port all of your changes to the new version).

    Popularity Contest supports filters, so you can define behavior like that outside of the plugin. To get rid of pages in almost all functions (which is, I think the behavior most people want) you can add:

    add_filter('posts_where', 'limit_pc_posts', 10, 0);
    function limit_pc_posts() {
    	return " AND post_type = 'post' ";

    somewhere in your template (I normally include a custom PHP file in all of my themes so I can add/remove things like this.


    The code from jbiesnecker breaks the whole blog on 2.8.6. May be because of custom queries I use?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Modify “Popularity Contest” plugin’ is closed to new replies.