I would like the create a link that point to the comment part. So when reader click on my link, it will scroll down to the place that they can leave a reply.

I have read some tutorial which teach how to create tag #id for headings in a post. However, I don't know how to do this for the comment part.

Please help! Thank you so much!

  • Edit your template, add an anchor ID just before your comment form, link to it :-) – Andy Macaulay-Brook Aug 5 '16 at 9:07
  • 1
    Thank you, but I need a little more details. @CoderSte has pointed it out. – Tai Christian Aug 16 '16 at 3:16

The code below should be something similar to what you're looking for

Inside the loop template you use for listing blogs (like index.php) you need something like this

<a href="<?php the_permalink(); ?>/#respond"> <!-- The blog permalink with the anchor ID after -->
    <i class="fa fa-comments-o"></i> Leave a Comment

Inside your comments.php file you could have this

<?php if ('open' == $post->comment_status) : ?>

    <div id="respond"> <!-- This is the element we are pointing to -->
        <!-- Code for comments... -->

<?php endif; // if you delete this the sky will fall on your head ?>
  • Thank you very much! I have inserted the class, then use function.php to create a short code for a button with the link jump to to the class. – Tai Christian Aug 16 '16 at 3:14
  • Awesome! Glad you managed to achieve what you needed to @TaiChristian – Stephen Aug 16 '16 at 7:49

I found a simpler solution, based on CoderSte's. Delete the

<?php the_permalink(); ?>/

from the first block of code, and then put it where you desire. That's it. The comment form already has the "respond" id, so you won't need to add the second block of code.

Removing the permalink part will prevent the site from reloading. It will simply jump to the comment section, which is the desired behavior.

This is all I added to my site. Add your button image in the tag.

<a href="#respond"><img src="" alt="" width="100" height="100" /></a>

protected by Community Apr 5 '18 at 5:41

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.