Changing the Size of the Avatar in WordPress 2.7

Changing the Size of the Avatar in WordPress 2.7

The default size of an avatar is 32x32px, which I think is a bit small. Therefore, I’d like to change it to 60x60px instead. But back in the good ol’ 2.6 days, and of course also earlier, changing the size of an avatar (the little picture shown e.g. in comments) was a pain. Now, with WordPress 2.7 it’s easier than ever!

And while we’re at it, remember to get yourself a gravatar.

In your theme, open the comments.php and look for the following code:

<?php wp_list_comments(); ?>

This simple line of code has a massive amount of options available. If you want to learn more about them, head over to the WordPress Codex pages and check them out. For now, we’ll just concentrate on changing the size of the avatar.

The way we can do this, is simply by adding some text inside the function, like this:

<?php wp_list_comments('avatar_size=60'); ?>

After that… No, actually there is no after that! By doing this, the avatar’s size will be changed to 60px.

Share, share, share!

Did you like this article? Please share it with your friends:
  • Digg
  • del.icio.us
  • Facebook
  • StumbleUpon
  • Technorati
  • Twitter
  • email

Related posts:

  1. No More Invalid RSS
  2. CSS3 is Not Freaking HTML5
  3. Adding Custom Google Maps to Your Website

18 comments so far

Add one yourself

  1. Jay Bell says:

    Thanks for the tip! I thought the avatars were a bit small as well.

  2. Clay says:

    What about in WordPress 2.9.?

  3. online stock trading advice says:

    what a great site and informative posts, I will add a backlink and bookmark your site. Keep up the good work!

    I’m Out! :)

  4. mwafi says:

    thanx :)
    working fine

  5. Daren says:

    In WP 2.8, you can change the default setting to display the gravatar in the comment-template.php file:

    function wp_list_comments
    $defaults = array ( ‘avatar_size” => 60,);

    The default is 32

  6. Chris-Kaas says:

    Great idea, but will this work over the long run?

  7. Gareth says:

    Nice, it really was that easy, edit comments.php and your done

  8. I’ve tried other method. It hasn’t work. However, this method that stiern post about, word beautifully! Thanks!

  9. wow says:

    very good………

  10. Bluesman says:

    On WordPress 2.7.1 (using K2 1.0-RC7 template) i changed those two lines in comments.php file:

    and

    <img src=”<?php gravatar(‘X’, 42, get_bloginfo(‘template_url’)

    Change ’42′ to the width and height of your desired avatar.

  11. Thank you SO much!!!

  12. Frank says:

    Hi… I can’t find the code!
    Here is a copy;
    post_password)) { // if there’s a password
    if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn’t match the cookie
    ?>

    Esta entrada esta protegida. Escriba una contrase�a para ver la entrada.

    <li id=”comment-”>


    <?php
    $mygravatarurl = get_bloginfo(‘template_directory’).”/images/gravatar-trans.png”;

    if (function_exists(‘get_avatar’)) {
    echo get_avatar( $comment, 69, $mygravatarurl);
    } else {
    //alternate gravatar code for < 2.5
    $grav_url = “http://www.gravatar.com/avatar.php?gravatar_id=
    ” . md5($email) . “&default=” . urlencode($default) . “&size=” . $size;
    echo “”;
    }
    ?>


    comment_approved == ’0′) : ?>
    Su comentario esta siendo revisado.

    <a href=”#comment-” title=”"> a las

    comment_status) : ?>


    Comentarios estan cerrados.

    comment_status) : ?>

    Deje un comentario

    Usted debe <a href=”/wp-login.php?redirect_to=”>Entrar para poder comentar.

    <form action=”/wp-comments-post.php” method=”post” id=”commentform”>

    Identificado como <a href=”/wp-admin/profile.php”>. <a href=”/wp-login.php?action=logout” title=”Salir de esta cuenta”>Salir »

    <input type=”text” name=”author” id=”author” value=”" size=”22″ tabindex=”1″ />
    Nombre

    <input type=”text” name=”email” id=”email” value=”" size=”22″ tabindex=”2″ />
    E-mail (no sera publicado)

    <input type=”text” name=”url” id=”url” value=”" size=”22″ tabindex=”3″ />
    Sitio Web

    <!–XHTML: You can use these tags: –>

    <input type=”hidden” name=”comment_post_ID” value=”" />

    ID); ?>