Stiern

via Ad Packs

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:

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:

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

25 comments

Leave one yourself

  1. Hi All,

    can anyone assist me with my problem?
    I wanted to resize the gravatar on my blog I did css, edit core files, I am using wp threaded comment and change everything but still no avail I was able to fixed other’s gravatar but not mine.

    I already did grep to look for that 32×32 pixel code that might be somewhere on the theme but really couldn’t find it.

    There must be some sort of css or code only for admin sort of function that I am missing…

  2. Excellent beat ! I wish to apprentice while you amend your web site, how can i subscribe for a weblog site? The account aided me a acceptable deal. I were a little bit acquainted of this your broadcast provided shiny transparent idea

  3. When I initially commented I clicked the -Notify me when new comments are added- checkbox and now every time a remark is added I get four emails with the identical comment. Is there any method you possibly can remove me from that service? Thanks!

  4. [ echo get_avatar( $comment, '60' ); ]

  5. echo get_avatar( $comment, ’60′ );

  6. use this code in “comments.php”

    u can change ’60′ to 32 40 80 …

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

  8. What about in WordPress 2.9.?

    1. You should be able to use the same method in WordPress 2.9. Otherwise, you can use the method described in a thread in the WordPress forum.

  9. online stock trading advice

    January 11, 2010 at 11:20 am

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

    I’m Out! :)

  10. thanx :)
    working fine

  11. 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

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

    1. As far as I know, this should work with future versions of WordPress as well.

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

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

  15. very good………

  16. 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.

    1. Nice! There seems to be several easy methods of achieving this, which is kind of funny, since it has always been a pain up until the release of 2.7.

    2. Thanks for this man.

  17. Craigsnedeker

    March 4, 2009 at 3:25 pm

    Thank you SO much!!!

    1. You’re so very welcome

  18. 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); ?>

    1. Are you sure this theme is updated for WordPress 2.7?

Trackbacks

Leave a comment

Required

Required (will not be published)

or Twitter URL

Some HTML allowed. Spam is not.