Get and Display Most Recent Comment on Every Post in WordPress

Few days ago, I was working on a site of my employer and one of the functionality of the site that in every post in index.php, category.php, archive.php except in single.php it would display the latest comment on every post, comment count and add new comment, doing such thing is very easy for advance developer, however this tutorial might helpful for beginner and I would like to share you this very simple tutorial.

PHP Code:

Use this code inside the loop to display comment on every post.

get_comments() funtions

Retrieve a list of comments.



  • status: Comment status to return.
    • hold
    • approve
    • spam
    • trash
  • orderby: Comment field used to sort comments.
  • order: How to sort $orderby.
    • ASC
    • DESC
  • number: Number of comments to return. Leave blank to return all comments.
  • offset: Offset from latest comment. You must include $number along with this.
  • post_id: Only return comments for a particular post or page.

The codes above only display latest single comment on every post, to add comment count, simply add this line of code.

comments_number() funtions

Displays the total number of comments, Trackbacks, and Pingbacks for the current post. This tag must be within The Loop.



  • zero: Text to display when there are no comments.
  • one: Text to display when there is one comment.
  • more: Text to display when there is more than one comment.

So now it displays the latest comment on every post with comment count and add comment link on it, if you wish to add CSS code in comment count display, use the complete code below.

Happy blogging.

by Ryan Sutana

  • I’m happy to read your blog

    • God help me, I put aside a whole aftrneoon to figure this out.

  • Very interesting info!Perfect just what I was looking for!

  • Very interesting information!Perfect just what I was searching for!

  • Thank you for every other informative web site. Where else may I get that kind of information written in such a perfect manner? I’ve a challenge that I’m simply now working on, and I’ve been at the look out for such information.

  • My brother recommended I might like this website. He was totally right. This post truly made my day. You cann’t imagine just how much time I had spent for this information! Thanks!

  • Thank you for this post.

  • I discovered your weblog site on google and verify a few of your early posts. Proceed to keep up the superb operate. I just extra up your RSS feed to my MSN Information Reader. In search of forward to studying more from you in a while!…

  • Howdy would you mind letting me know which webhost you’re utilizing? I’ve loaded your blog in 3 different internet browsers and I must say this blog loads a lot quicker then most. Can you suggest a good web hosting provider at a fair price? Thanks a lot, I appreciate it!

  • Respect to author , some wonderful information .

  • I simply want to say I am just beginner to blogging and definitely liked this web-site. Most likely I’m want to bookmark your website . You definitely have exceptional articles and reviews. Thanks a lot for sharing your blog.

  • You got a very excellent website, Gladiolus I noticed it through yahoo.

  • I think other web-site proprietors should take this website as an model, very clean and great user friendly style and design, let alone the content. You are an expert in this topic!
    movie soundtracks

  • Get and Display Most Recent Comment on Every Post in WordPress | Very nice post. I just stumbled upon your blog and wished to say that I have truly enjoyed browsing your blog posts. After all I will be subscribing to your rss feed and I hope you write again soon!

  • I really like your blog.. very nice colors & theme. Did you create this website yourself or did you hire someone to do it for you? Plz reply as I’m looking to design my own blog and would like to know where u got this from. many thanks

  • Thank you for the auspicious writeup. It in fact was a amusement account it. Look advanced to far added agreeable from you! By the way, how can we communicate?

  • Passion in what you believe and in putting it in words is a real gift. Your informative article contains the optimal combination of passion and well-written, interesting content that I’ve grown to appreciate and respect.

  • It is definitely a great and also beneficial part of data. I am satisfied that you just discussed this particular helpful information with us. Please remain us informed similar to this. Many thanks for revealing.

  • I actually planned to discuss your blog post is incredibly realistic. I opt to hear something totally new with this on account of I really provide the identical site within my United states during this matter so this specific help??s everyone plenty. I was able to a good look about the topic plus noticed a great a number of blogs but in contrast to that. Thank you for revealing so much inside

  • Just wіsh to say yοuг artісle is as surprising.
    Τhe сlarity in your post is ϳust speсtaсulаr and i cοuld assume you’re an expert on this subject. Fine with your permission let me to grab your RSS feed to keep up to date with forthcoming post. Thanks a million and please keep up the rewarding work.