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!
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
</a>
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... -->
</div>
<?php endif; // if you delete this the sky will fall on your head ?>