Show Popular or Trending Post in WordPress

Recommended by 125 people
. in Tutorial, web . 1 min read
Recommended by 125 people

Front page of muchad.com, show popular posts based on comments count. We can do it without plugin. To show some popular posts in WordPress we can do it with this simple script in your theme’s file.

This source code will show 3 popular posts. The problem, it only show posts with many comments count in all of time, so if no another post with comments count more than that posts, this post will be always shown like a static, no other post to show.

 

Trending Posts

To make it more flexible, muchad create a script that not only based on comments count but also “post like count” in a month, so it like trending posts in a month. Post like count is not default from WordPress, you must create it first. About creating “post like count” you can read this.

You can add this script to your theme to show trending posts in a month.

Try it, if you have any problem, just leave a comment. Like it? Please click <3



Other stories written by muchad
Recommended stories
Responses
 
Write a response...
Your email address will not be published. Required fields are marked *

muchad.com Comments List
muchad.com comments

Pretty nice post. I just stumbled upon your weblog and wished
to say that I have truly enjoyed browsing your weblog posts.
After all I’ll be subscribing in your rss feed and I’m hoping you write once more soon!

muchad.com comments

Hmm it appears like your blog ate my first comment
(it was extremely long) so I guess I’ll just sum it up what I wrote and say, I’m
thoroughly enjoying your blog. I as well am an aspiring blog writer
but I’m still new to the whole thing. Do you have any
tips for first-time blog writers? I’d really appreciate it.