Unique Comment Links

Posted on Tuesday, March 10th, 2009 at 10:49 am in

I was reviewing a WordPress blog recently and, in my ‘report’, noted that it suffered from the common WordPress issue of comment links that did not clearly identify the link target and would not make sense when taken out of context (e.g. “No Comments”). The site’s owner replied that he’d found some fixes but that they were now dated. That surprised me as the “fix” really is very simple.

Once within The Loop, all of the attributes of the $post object are available to use — including the post’s title via $post->post_title. So it’s just a case of passing the post title to comments popup link in your template:


<?php if('open' == $post->comment_status) : ?>
<p class="comment_link"><?php comments_popup_link('Comment on '.$post->post_title, '1 Comment on '.$post->post_title, '% Comments on '.$post->post_title,'postcomment','Comments are off for '.$post->post_title); ?></p>
<?php endif;?>

Voila! Unique comment links.

3 Comments

  1. Ted - March 15, 2009 at 2:09 pm

    Hi there,

    I downloaded the latest version. Uploaded it, activated it, and it tells me to work the plugin has to be deactivated and reactivatd. I did this and then you get the same message. I am not sure if anyone else is having this trouble, but I was wondering if there was a work around?

    Thanks.

  2. rich - March 16, 2009 at 4:40 pm

    I assume you mean eShop?

    Could you repost this on the forum, after you’ve updated to 3.2.1, and whether or not the problem goes away.

  3. John - December 3, 2010 at 10:25 am

    Thanks i just used this to fix my wordpress blogs comments.

Sorry, the comment form is closed.

WordPress Theme Development

Top