How To Customize Author’s Comment Box and Comment Avatars In WordPress

April 14th, 2009 · Posted in Blogging, Tutorials, Wordpress

author-comment1

Lately, I’ve been working in some small details in my blog – as some of you might have noticed.  This time, I just wanted to post a quick tutorial about how to customize your comments in your WordPress blog.

How to Change the Style of the Author’s Comment in WordPress

You probably have seen this before, whenever you are reading the comments of a post and you notice that the author’s comment is highlighted in a particular way, just so it’s different than the rest. Well, there are many ways to get this done.

An easy way to do it is by going to Appearances -> Edit -> style.css and add the following class:

.author_comment {
background-color: #F1C056 !important;
}

This simple class will just change the background of the author’s comment box. Here you can customize the style of your author’s box by changing the border color, etc.

Finally,  you need to make a small change in comments.php,  so go to Appearances  -> Edit -> comments.php. Once you are in the page, look up the line

<li <?php echo $oddcomment; ?>id="comment...

Change it to this:

<li class="<?php
/* Only use the author_comment class from style.css if the user_id is 1 (admin) */
if (1 == $comment->user_id)
$oddcomment = "author_comment";
echo $oddcomment;
?>" id="comment…

That’s all, if you followed this two simple steps correctly, your author’s box should be displaying with an improved and personalized style.

How to Change the Avatars Sizes in Comments

This is really easy, the kubrick wordpress template resizes the images to 32×32 by default. In order tyo change the sizes, go to Appearances  -> Edit -> comments.php and look up

<?php echo get_avatar( $comment,

You will find a line that looks like

<?php echo get_avatar( $comment, 32 ); ?>

In order to make the image bigger just try changin the number 32 to 50.  That’s all.

I hope you enjoyed this small tutorial.  Until next time!

Share & Enjoy:
  • Digg
  • Facebook
  • del.icio.us
  • TwitThis
  • email
  • StumbleUpon

About the Author
My name is Karina Myers, I'm a web developer located in Michigan, US. To learn more about my work visit my portfolio, and services page. You may also contact me via email. I'd love to hear from you!
Did you enjoy this article?
karinamyers.com is a one person's operation. I try to make every article useful and well presented. Sometimes, writing an article can take weeks to just do the research and gather information. So, if you feel like returning the favor, buy me a cup of tea!

Tags: , ,

3 Responses to “How To Customize Author’s Comment Box and Comment Avatars In WordPress”

  1. Jane Jane Says:

    Thank you, Karina, for helping us bloggers. I’m trying to add your code to change to the stylesheet the color of the author’s comments but maybe I’m not putting it in the right place because the color did not change.

    I added it to the bottom of this section:
    /* Comment Form

    But that didn’t do anything.
    Can you give a bit more direction for us novices?
    Thanks,
    Jane

  2.  admin Says:

    Hi Jane,

    Thank you for your message. Could you please copy and paste here how your code looks like? I’ll check if everything looks the same.

    Remember, /* in CSS means the beginning of a commented text so make sure you have your commented text closed with */ at the end. Once you have your commented text closed, you can add the rest of your code.

    Karina

  3. Awsome Awsome Says:

    nice one keep it up cutie great tuteral there !

Leave a Reply

Related Posts Widget for Blogs by LinkWithin