January 7th 2009 by Peter · 18 comments
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.







Thanks for the tip! I thought the avatars were a bit small as well.
What about in WordPress 2.9.?
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.
what a great site and informative posts, I will add a backlink and bookmark your site. Keep up the good work!
I’m Out!
thanx
working fine
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
Great idea, but will this work over the long run?
As far as I know, this should work with future versions of WordPress as well.
Nice, it really was that easy, edit comments.php and your done
I’ve tried other method. It hasn’t work. However, this method that stiern post about, word beautifully! Thanks!
very good………
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.
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.
Thanks for this man.
Thank you SO much!!!
You’re so very welcome
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); ?>
Are you sure this theme is updated for WordPress 2.7?