Tips For Highlighting Author Comments in WordPress

In the past we’ve gone over some methods for setting up your theme to separate your author comments in WordPress.   By default, most WordPress themes check the e-mail address to determine who the person is that is leaving the comment.   By adjusting the code to check for the user id instead, you can set up your theme to recognize if you are the author of the post.   This is also beneficial for blogs with multiple authors. 

In addition to separating trackbacks from comments, this is another way you can easily help improve the readers experience when trying to follow a conversation in the comments.    Most people use a different background, but some choose to instead display a logo.   The important thing is that readers can recognize which comments are coming from the author of the post. 

Today I noticed Matt Cutts has written his own tutorial explaining how to highlight author comments in WordPress.   His post also includes the code needed for CSS styling.  If you still haven’t gotten around to doing this on your theme yet, I recommend you check it out!  

Improve Comment Recognition with the MyAvatars WordPress Plugin

There are a variety of things a blog author can do to improve comment recognition on their blog, ranging from comment author styling to adding additional information to your comments.   Comment styling can go a long way to help single out the authors comments, but what about your top commentators?  If you get a lot of comments on your blog, it is probably fairly common for commentators to get involved in a discussion that doesn’t involve one of the authors.  

This is where comment avatars are truly useful, as they allow readers to associate pictures with the comments themselves.   When reading type, its different then seeing people talk or hearing their voices.  Typing is unique, therefore providing a visual cue such as an avatar allows readers to easily follow who is saying what and see who is talking back and forth. 

For WordPress users, thanks to the great WordPress plugin community we have, there are a large variety of ways to add personal avatars to your blogs comments.  The benefits to doing this are numerous, but in my opinion the most important benefit is the personal branding.  This is why I usually recommend blogger’s use a picture of their site’s logo, favicon, or something memorable instead of a personal picture as their avatar.  This helps people to associate your avatar with you as a person and as a blogger.

Currently, there are 3 different types of avatars that are popular.   The most popular plugin currently is the MyAvatars plugin. This plugin looks at the commentators e-mail address and matches it up with their MyBlogLog profile. It then places their MyBlogLog avatar next to their comment, allowing users to easily indentify the comments with the person writing them. The reason I prefer to use this plugin on most of my blogs is because it seems to cause the fewest problems with site load time and also seems to get the fewest number of blank avatars. If for some reason you don’t like MyAvatars, their are two other good choices.

The first alternative option is Favatars, which is a favicon plugin that will look at the URL used in your comment and add the favicon from that site next to your comments. This is nice, but there are many sites that don’t have a custom favicon.   Hack WordPress uses Favatars only because there wasn’t enough room to include an avatar next to the comments on this blog.   In the future I plan to redo the comments section, so I expect to switch to MyAvatars once this is done. 

Your second alternative option is the Gravatar plugin, which works just like MyAvatars, except it uses your Globally Recognized Avatar (Gravatar).  Unfortunately, very few people actually have a Gravatar it seems due to some site performance issues, so that is why I list this as the third best option.  Hopefully this will change now that Automattic owns Gravatar.  A quick Google search will also show a few other versions of Gravatar plugins available if you like the idea of displaying gravatars on your site. 

Overall, the type of plugin you use doesn’t matter, but I believe it is important to display some sort of avatar next to your blog’s comments.   MyBlogLog seems to provide the fewest blank avatars, so that is why most people prefer it over the other two.  

How To: Separating Your Author Comments in WordPress

This post is being written as part of the Geeks Are Sexy How-To Contest

Have you noticed while visiting some of your favorite blogs that many author comments are styled differently to help the authors comments to stand out?   This is something that isn’t overly difficult to implement on your WordPress blog, so I decided to write a quick how-to post explaining how you can easily adjust your WordPress theme to display different styles for each author.

First, you’ll need to make some adjustments to the comments.php code.   Look for something similar to the following code:

<li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">

Replace the above code with the following code:

<li class="<?php if ($comment->comment_author_email == "admin@yourdomain.com") echo 'author'; else echo $oddcomment; ?> item" id="comment-<?php comment_ID() ?>">

You’ll want to modify admin@yourdomain.com to reflect the primary blog author’s e-mail address.  This will tell WordPress to check each comment to see if you are the author.   Now go to your CSS Stylesheet (style.css) and add the commands you would like to use for your author comments.   You’ll want to use .author to style your author comments.  I recommend pulling your standard comment code, then adjusting the colors to look different on your comments.  You can also add a logo through your stylesheet.

How do I do this if my blog uses multiple authors?   If your blog features several different authors, you’ll want to make a slightly different adjustment to the above code so that it looks like this:

<li class="<?php if ($comment->comment_author_email == "author@yourdomain.com") echo 'author'; else if ($comment->comment_author_email == "author2@yourdomain.com") echo 'author2'; else if ($comment->comment_author_email == "author3@yourdomain.com") echo 'author3'; else echo $oddcomment; ?> item" id="comment-<?php comment_ID() ?>">

In the above example, we are assigning the primary author as .author and adding their e-mail address where it says author@yourdomain.com.   When the comment includes that e-mail, it will use the .author style from the stylesheet.  The second author will use .author2 for their stylesheet and replace author2@yourdomain.com with the 2nd author’s e-mail, etc.   Any comments that don’t include one of the above e-mails will use the standard styles.

Once you’ve got your code adjusted and added the author(s) commands to your stylesheet you will be ready to start commenting!