One important link in the comments section of wordpress is the individual comment link. If a post only has a few comments it isn’t really essential however the more comments your posts get the more helpful. The comment link allows you to link to a specific comment on a thread. This can be incredibly helpful if you are referring to the 150th comment of a post!
I thought it would be useful to explain how to add this link as there are a lot of free themes available which do not have this link in the comments template.
Here is a pic showing where i display the link on Blogging Tips :
As you can see, i number all comments so that its easy for people to refer to specific comments. You don’t have to do this - you could always just put ‘Link to this coment’ or something to that effect in the comment info area (eg. where the time of the comment etc is stated)
The Code
To link to a comment you use :
<a href="#comment-<?php comment_ID() ?>">
So if you wanted to link to the comment in your comment info area you could use
<a href="#comment-<?php comment_ID() ?>">Comment Link</a>
I think that numbering comments is useful though so this is the code i use :
<span class="count">
<a href=”#comment-<?php comment_ID() ?>”><?php echo $i; ?></a>
</span>
<?php echo $i; ?> is the code which displays what comment number the comment is (eg the 4th comment to be posted in the article).
The css class i use is labelled count - all it does is align the link to the right hand side of the comment and make the text size a bit bigger. Here is the code to do just that :
.count {
float:right;
font-size:26px;
}
Overview
Your wordpress theme may already have this code in it however if it doesn’t and your getting a lot of comments to your posts you may find adding the link code makes it easier for your readers to refer to individual comments.
If your unsure about any aspect of it please let me know ![]()













Community Building Blog | May 17th, 2007 at 7:21 am #
Do you think that if people start referring to others by numbers as opposed to names, this would reduce the community feel of your blog?
I would rather be called Martin than #7!
- Martin Reed
Thomas Clausen | August 12th, 2007 at 3:05 am #
I simply can’t figure out where to put the code! I use k2, and I’m thinking comments.php but also where in the comments file?
I’ve tried different places, and nothing is showing up
Kevin | August 12th, 2007 at 8:46 am #
Could you post the code for the comments.php file in the forums. Ill see if I can help
den | April 17th, 2008 at 7:07 am #
Could you post the code for the comments.php ??