Being able to link to specific comments in your WordPress blog could be very handy. Good comments can really add a lot of value to a blog, and you or others may want to refer to specific comments in your posts by linking to them. In general, comments can be linked to, but to figure out what the URL is for every comment is virtually impossible, unless…you set up your comments section of your blog so that every comment gets a link.
Here’s how you would create a link around the date and time of your comment:
<p><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('F jS, Y') ?> at <?php comment_time() ?></a></p>
This piece of code should appear in your comments.php theme file where your comment code appears.
If you want an “Edit Comment” link to appear next to the comment for those who are logged in and have permissions to edit, you would add the following code:
<p><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('F jS, Y') ?> at <?php comment_time() ?></a><?php edit_comment_link('Edit comment',' ~ ',''); ?></p>
So there you have it boys and girls: now you can link to comments, and share the love with your commenters!