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.
Farneville
August 11, 2011 at 7:36 pmHi 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…
Roulette
July 14, 2011 at 9:42 amExcellent 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
jigsaw
February 10, 2011 at 3:26 amWhen 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!
POUYA
November 14, 2010 at 10:14 pm[ echo get_avatar( $comment, '60' ); ]
POUYA
November 14, 2010 at 10:13 pmecho get_avatar( $comment, ’60′ );
POUYA
November 14, 2010 at 10:11 pmPOUYA
November 14, 2010 at 10:09 pmuse this code in “comments.php”
u can change ’60′ to 32 40 80 …
Jay Bell
March 17, 2010 at 12:13 amThanks for the tip! I thought the avatars were a bit small as well.
Clay
January 14, 2010 at 5:36 amWhat about in WordPress 2.9.?
Peter
January 14, 2010 at 7:04 amYou 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.
online stock trading advice
January 11, 2010 at 11:20 amwhat a great site and informative posts, I will add a backlink and bookmark your site. Keep up the good work!
I’m Out!
mwafi
December 28, 2009 at 4:21 pmthanx
working fine
Daren
November 23, 2009 at 4:23 pmIn 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
Chris-Kaas
July 29, 2009 at 10:33 pmGreat idea, but will this work over the long run?
Peter
August 10, 2009 at 6:29 pmAs far as I know, this should work with future versions of WordPress as well.
Gareth
June 8, 2009 at 4:58 pmNice, it really was that easy, edit comments.php and your done
hybridanime49
June 4, 2009 at 10:34 pmI’ve tried other method. It hasn’t work. However, this method that stiern post about, word beautifully! Thanks!
wow
March 20, 2009 at 10:16 amvery good………
Bluesman
March 7, 2009 at 3:29 amOn 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.
Peter
March 7, 2009 at 9:04 amNice! 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.
Alex
June 2, 2009 at 9:42 pmThanks for this man.
Craigsnedeker
March 4, 2009 at 3:25 pmThank you SO much!!!
Peter
March 5, 2009 at 1:12 amYou’re so very welcome
Frank
January 29, 2009 at 6:36 pmHi… 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); ?>
Peter
January 30, 2009 at 12:48 amAre you sure this theme is updated for WordPress 2.7?