Support » Plugin: WordPress Popular Posts » [Plugin: WordPress Popular Posts] Category Specific?

Viewing 11 replies - 1 through 11 (of 11 total)
  • I agree, this would be most helpful.


    Looking at the code in ‘wordpress-popular-posts.php’, I was able to do this by adding an extra category string to the $mostpopular string. I based it off of ramdev’s exclusion code and added it immediately afterward. Here’s what you are looking for, I believe:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Let me know if that makes sense!

    Sorry, I could not get that to work. Seems like there is a lot more to be done than just your code snippet.


    It seems to be working on my end… does it just break the plugin for you or does it appear to not do anything at all? Are you using exclusion categories because I haven’t tested that on my end. I modified my removed code from above and added something that tests which category you are currently within… could you try this and let me know if it correctly displays the current category?

    (Note that I changed the line that says $content = ”)

    I need to add this functionality as I use the other wpp tags for other pages like:

    [wpp range=all limit=20 stats_views=1 order_by=views pages=0 wpp_start=<ul> wpp_end=</ul>]

    So, in addition to using the shortcode above, I would like to use one like:

    [wpp range=all limit=20 stats_views=1 order_by=views pages=0 include-cats=65 wpp_start=<ul> wpp_end=</ul>]

    which means I need a new attribute called include-cats.

    Gotcha! I was doing the above based on the premise you were using a widget and that widget was applied site-wide…

    In any case, I’ve done what you asked, using the shortcode attribute “cats_to_include”. The attached code also includes a “Restrict posts to categories” checkbox in the widget. I’ve simply added my entire rework of wordpress-popular-posts.php because there were about six different areas I had to add code. I’ve included “kaynenh” in the comments of every edit so you can search and find the changes.

    You are ‘da man! I replaced your code with the code in the WPP .php file and voila, I now have a capability to show popular posts based on included categories.

    Thank you very much!


    Do we just need to replace the entire code in wpp php file to what you have at that link? Anyone know if the plugin developer will actually implement this moving forward (IE – should I just wait for an updated version)?

    Thanks in advance.

    Replace all of the code with the code at the link above.

    BTW, the original code is causing significant throttling by my host. The new code doubled the amount of throttling. So, if there is an issue with the way popular posts is being implemented, then the problem has been repeated. I have a programmer friend looking at the code for me to see if he can tell what is causing the problem. Will let you know if we find a solution.

    Please check throttling on you site. Try deactivating the WP-popular-posts plugin for a day and compare your throttling values. Then, see if the new code makes the throttling problem double. If so, we definitely need to get this fixed.

    @wpelliott – any further insight on your end with regard to the throttling… And (cause Im more of a marketer, just enough IT knowledge to be dangerous 🙂 how would someone see this? Is this CPU usage that I would see on the server or slow down within the wp-admin console? Perhaps you’ve already determined that it’s ok now or you’ve been able to fix it? I love your thoughts as I have a pretty heavy volume/traffic to my site and quite a few plugins so… Im afraid to try it because if the site goes down, so does the income 🙂 Thanks in advance..

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘[Plugin: WordPress Popular Posts] Category Specific?’ is closed to new replies.