Support » Plugin: Popularity Posts Widget » Filter category dynamically

  • Hello, I’d like to filter the popular posts displayed when the user clicks on a category. For example, suppose I click on a “Yoga” category, I’d like the popular posts widget to only display the most popular posts from the “Yoga” category. How can I do this? Happy to write some code if you give me some tips. I’m familiar with customizing wordpress. Doesn’t look like the “filter” in the widget itself is dynamic.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author ILLID


    I make some changes for you: now in category page plugin will show only posts from the same cat.
    I hope this is what you want.

    I upgrade file class_popularity-posts-widget.php. Download new version of this file you can here:

    Thank you – I updated the staging environment for my blog at: with this new file, however, the popular posts widget still doesn’t seem to be filtering by category when I choose one. Please try it out. Am I doing something wrong?

    Sorry, I wasn’t clear. It IS working perfectly (Thank you!!) for when a category is selected, but if no category is selected, I’d like it to show the most popular posts from across the blog. Right now, on the homepage it is empty:

    But in a category it works great:

    Sorry, the plugin now seems pretty inconsistent. You can try filtering by categories, and you’ll notice that popular posts from other categories also show up. Why is this?

    For example, I go to the “Crossfit” category, but posts from “Barre” show up as popular in the widget. Ideas?

    Plugin Author ILLID


    Ok, tonight I will watch what is wrong witch it.

    I pushed it to our live blog:

    We get fair traffic to this blog, and you can see that the filter isn’t working, and it looks like it’s not updating dynamically based on clicks either.

    Hello, were you able to find anything? I’d love to get this working on my blog.

    Plugin Author ILLID


    There is new version of plugin available now.
    I hope it will works fine for you.

    I updated it and then immediately nothing showed up on my site…

    meaning, there no longer were any popular posts. Perhaps this is because I updated my previous code with the extra code you gave me? Could you please give me a zip of the correct code that I can try?

    Hello there, I’m having two issues:

    Please take a look at my blog here:

    1) In the popular posts widget, if you inspect the element it is adding linebreaks. I’d like to remove them so that the picture and the text are right next to each other.

    2) I’d love if when the user when to a category, that the popular posts for just that category showed up. Same if they visit a post from that category.

    Paul, did you work this out in the end?

    1) Not ideal, but you could just display: none; the linebreak in your CSS

    2) You can do this with the widget logic plugin, by setting up a separate PPW widget for each category, and then making sure it is only shown on the siderbar of content in that category with widget logic along the lines of is_category(1) || (is_single() && in_category(1))

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Filter category dynamically’ is closed to new replies.