How To Highlight A Comment From The Author
I have seen many blogs where the author’s comments are shown in a specific way. This makes sense if you - as the author - are answering specific questions. I have seen this on many plugin sites. Marking your comments makes it easier for your visitors to see important answers.
Inspired by the “Author Highlight” plugin for wordpress, I put some simple code into the loop of my comments.php which shows a “This is a comment by the weblog author” note below the date and time of the post:
<?php if(strcasecmp($comment->comment_author_email, 'youraddress@yourhost') == 0)
{
echo "<span style='color:blue; font-weight:bold'>This is a comment from the weblog author.</span>";
}
?>
[Update from 2008-06-24]
Matt Cutts actually describes a nicer different method by identifying the author’s ID in this post. [Update] That only works if you are logged in while commenting - otherwise, the user_id is “0″ and the highlighting won’t show.
The post ends here. Wanna leave a response? Have Your Say!
BTW: This post has comments.
Next post: WordPress Plugin “GoodLinks”
Previous post: The Blog Herald - News For Bloggers
The above post was initially scribbled on May 17th, 2007 @ 23:50:19 +0200 (CEST) and has been last modified on October 14th, 2008. It is filed under the category WordPress Stuff and has been tagged with the terms [comments | plugin | wordpress].
Sorry, still gathering information...
Trackback URI | Comments RSS | Permalink




Comment
#1
You should leave a comment so we can see.
Comment
#2
Ok, here it is. I have slightly changed the CSS, so that by now, you should see a thick border and a light yellow as background color, whereas comments from visitors have a thin border and either white or grey as background color.
Comment
#3
thanks dude
Comment
#4
It is a great way and really eye catching though… I am wondering if it is compitable with WP 2.7 Beta as well. Thanks alot, regards