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!














There Are 6 Responses So Far »
Pingback: How To Separate Comments and Trackbacks On A WordPress Blog
Pingback: Yazar ile okuyucunun yorumlar?n? farkl? biçimlendirmek
Pingback: [GAS] “How to” Contest - Full Submission List | [Geeks Are Sexy] Technology News
Pingback: 30 Most Wanted WordPress Comments Page Hacks | instantShift
Pingback: 30 astuces pour améliorer la présentation des commentaires dans WordPress | Presse-Citron
Pingback: 16 truques e dicas para estilizar e modificar os comentários do seu blog! | Wordpress Love - Themes, Plugins e tudo para Wordpress, em Português
Pingback: US Want - Your Blogs, Social Network, Search Engine for Drivers, UserGuide, Vids, Images, Tutorials
Pingback: 33 Most Useful Worpdress Comments Page Hacks - Themeflash : One Stop For All Your Web Resources
Pingback: 100+ Massive Wordpress Tutorial Collection | tripwire magazine
Pingback: 30 Wordpress Yorum Sayfas? Düzenlemesi | Sorbize
Pingback: 20 Very Useful Comment Page Hacks for WordPess Users | blueblots.com
Pingback: MsKcR | Bilgi Payla??m Portal? » Blog » Wordpress Yorum Sayfas? Eklentileri
Pingback: 60 Most Wanted WordPress Hacks | stylishwebdesigner