Show Popular Posts of Current Browsing Category

March 5th, 2009

WordPress really is a remarkable tool but there is no way to show popular posts of current category you are browsing just by using WP template tags. For instance if your blog has category Sport, it would be nice to show of the most popular posts in that category for the last month or so -> automatically of course….Well, I was searching for  plugins that would do the trick, code snippets and much more but haven’t found anything similar so I’ve decided to code this myself – directly from database.

And because I really love simplicity this code is also as simple as possible…Here is what you should do:

  1. Download archive.php file found below
  2. Open your theme theme file also called archive.php
  3. Use my code at your own risk=) … just be careful and place it outside loop

[download id=”2″]

This code snippet is aimed at WP theme developers and those that know a thing or two about coding,…sorry for everybody else;)

Related Posts (auto generated)

One Response to “Show Popular Posts of Current Browsing Category”

  1. Bil

    13 years ago

    how can I implement this code in a widget?

    Reply to this comment

Leave a Reply