• Blogging
  • Freebies
  • Freeware
  • How-To
  • Make Money Online
  • Mobile
  • Home >> How-To >> How to add Comment Link in Single Post – WordPress

    How to add Comment Link in Single Post – WordPress

    Have you noticed Home Page of this blog? On the right of each Post Title you will see a balloon image which shows number of comments for the post. This is a hyper link, if clicked will take you to the comments section of the post.

    Check right top of the image

    Check right top of the image

    Most of the themes comes with this feature. My theme also has these feature.

    Now, I wanted to display the same type of Comments Link in Single Post.

    This is what I did, I opened index.php theme file. Found the following code and copied it.

     <div class="comm"><span><?php comments_popup_link('0', '1', '% '); ?></span></div> 

    Then, I opened single.php and pasted the code just above the title and saved the file.

    I then opened the post in the browser to see the whether the comment link is appearing in the Single post or not.

    I was surprised to see that there was no Comments Link in the post. Then, I opened the source code of the page, but was unable to find the code that i pasted.

    After doing some research, I found out that Comments popup link will only work inside a loop. index.php uses the loop, but single.php (Single Post) doesn’t.

    I found some clue to the solution. If you closely look at the start of the comments section below:

    Display number of comments in comments header section

    Display number of comments in comments header section

    You can see that number of comments are displayed in the header of the comments section. I immediately headed to comments.php and found that there is a comments_number function which is outputting this. I then used that function to achieve my goal.

    Do the following to add Comments Link in Single Post:

    1. Copy the below code.
       <div class="comm"><span><?php comments_popup_link('0', '1', '% '); ?></span></div> 

      Note: You have to use CSS classes to give the styling. Here, comm class is being used.

    2. Open single.php
    3. Paste it just above the title.
    4. Save the file

    Try opening any post in your browser to see the change. If you see the comments link in the post, then you are done. Otherwise try checking what went wrong.

    This how I used different function to display Comment link in single post!!!

    I hope this helps…

    If you have any doubts or suggestions, please do leave a comment.

    Check out more tips on WordPress!

    IMPORTANT: This blog welcomes Guest Bloggers, Writers to also contribute by writing Guest Posts and also Make Money!. Check out our Revenue Sharing Program
    1924 readers are already subscribed to this blog! Why don't you be one of them? Subscribe to this blog via your favorite RSS feed reader or by entering your email address on the form below:


    1. TechnoSamrat says:

      Simple and great find nihar….

    2. Good tutorial! I like the way you explain what went wrong and how your corrected it. Your learning process sounds like mine – find an example of what works and use it on the page I want to edit.

    3. This gives me solution for my other blogs!!

    4. Atniz says:

      Good guidance given as usual. Thanks for sharing it.

    5. It does add to the appearance to the overall look of the blog. Looks very easy to do and instructions are very good.

    6. Ryan says:

      I like how your blog has the little speech bubble that displays the number of comments.

      This code is also used for the most commented posts at the bottom of this page?

    7. Nihar says:

      @Ryan, no, the most comment posts at the bottom of the page is a plugin that i have used. It can be also a piece of code that can be manually added.

    8. Steve Yu says:

      Nice and clear tutorial. Write more WordPress tutorials. They are really useful.

    9. nice tip but what about changed the color of the ballon ? or at least customize it .

      but easy way to do it thanks

    10. Wade Briggs says:

      This is a little off the wall but have you checked out Zemanta yet for blogging? I know how you love your wordpress plugins, etc. so you should check it out. It’s a plugin that basically suggests relevant articles and images to your blog post as you write it. Definitely a handy tool that adds depth to my blogging. You should give it a try Nihar. šŸ™‚

    11. Nihar says:

      @Wade Briggs, thanks for the information. I will have a look at it.

    12. Great tip Nihar. I had a feeling it had something to do with the loop. Good thing I found your article. I love your explanation, simple and straight to the point! Thank you for sharing.

    13. Nice and clear really useful.It has good navigation for those who want to directly jump to the comments section.

    14. enver says:

      know how you love your wordpress plugins, etc. so you should check it out. It

    15. gabier says:

      Hi, a happy new year to everybody.
      Sorry, probably I missed something because everybody says it is easy, but I can’t implement it.
      The fonction comment_popup_link(), which is in the code to be copied and pasted, does not work, as it is said at the beginning.
      As for the comments_number() function, it displays the number, but it is not a link. …
      So, what is to be copied and where ?

      šŸ™‚ gabier

    16. Clevastin says:

      This is an wonderful information for me. I agree with this information and this is very useful for me. I can get lot of things from here which will be very useful for my future.
      Thanks for this valuable posting.

    17. Nice information. i will look on it it is very useful and help me a lot.

    18. cv2impress says:

      nice post.thanks for sharing it.

    19. You WP Diva says:

      Hi Nihar. I am always looking for great information about WordPress and am glad I found your site. I look forward to reading more from you. Mind sharing what theme you are using for this blog?

      Take care

    20. Jay Boom says:

      Thank you for the tutorial Nihar, very unique and cool. It adds some style in the website. I learned something and it really helps.

    21. Setti Olga says:

      Wow! This could be one of the most helpful blogs we have ever come across on thesubject. Actually great post! Iā€™m also an expert in this topic therefore I can understand your effort.

    22. Manoj says:

      can anybody help me how to create wordpress plugins as well as which file is important in wordpress thems..

    Leave a Reply

    page counter
    NiharsWorld on Twitter NiharsWorld on Facebook NiharsWorld RSS Feed