Trending Posts widget for WordPress

wordpressWhile bloggers are affectionate about each article they write it’s not necessary that readers will like all of them equally. It becomes clear within 2 weeks which of the latest articles suit the taste of the visitors better. Though the author would love to have those posts noticed they get lost very soon as new posts get added. WordPress has a widget for Top Posts & Pages but if a blog is more than a year old the list becomes almost constant or the same posts keep shuffling in and out of the list. The reason is popular older posts in general are read more times than the newer ones. So even if one wrote a great article 10 days back and it got many visits quickly, the count will fall sharply as it moves to page 2 of the blog. Some themes support highlighted (super-awesome) posts in the home page but it may not be a good choice for regular visitors and will deprive the newer posts the attention they deserve.

How to keep your latest best in plain sight for a while to catch your visitors’ attention? I thought of Trending Posts – posts around 1 to 2 months old which got the most visits. While the algorithm to write a widget to fetch those posts is simple, free WordPress users are limited in the things they can do. So I thought of using the Text Widget to create such a list. You can see the resulting Trending widget in action in the left column of this blog. Here’s what I did:

  • Go to the Stats page and expand Top Posts & Pages. Click on Summaries.
  • To pick posts from last 45 days change the 7 at the end of the URL to 45. You can choose any number of days you want.
  • Now check the list and find out which of the posts published within the last 45 days are at the top and add an entry in the Text Widget for that post. Here’s an example:
    <li><a href="http://oldpapyrus.wordpress.com/2013/11/24/rotate-video-using-handbrake/">Rotate videos using HandBrake</a></li>
  • You can add any number of entries. I prefer 6.
  • Save the widget and you are done!

Leave a Reply

Your email address will not be published. Required fields are marked *