How to Change Avatar Size in WordPress Comments

I wanted to increase avatar size (Gravatar) in my WordPress comments, but any amount of CSS tweaking for the avatar size would not work. I realized the avatar size was generated hard coded in html and there was no way to change that.

A quick view at your comments.php file would reveal that the comments are output by this code.

<ol class="commentlist">
<?php wp_list_comments(); ?>
</ol>

Note that we had set the type argument to show comments only (not pingbacks / trackbacks) so our code looks like this right now

<ol class="commentlist">
<?php wp_list_comments(array('type' => 'comment')); ?>
</ol>

So wp_list_comments is the target file which generates the hard coded avatar size of 32x32px. I wanted to increase the avatar size to 48x48px, so here is how I modified the code to look like this. Change the 48 to any size you like from 1-512.

<ol class="commentlist">
<?php wp_list_comments(array('avatar_size' => '48', 'type' => 'comment')); ?>
</ol>

Now we are showing comments with avatar size of 48x48px. Post a comment and try for yourself. (Obviously you have a gravatar by now with the same email address or your avatar would not show on any site).

Share with friends

10
Leave a Reply

Leave a Reply

  Subscribe  
newest oldest most voted
Notify of
dvdrippingsoftware
dvdrippingsoftware

Im sure this is useful for wordpress novices like me …

caroline wabara
caroline wabara

Thanks for the tip. I’m gonna try this.

Julian
Julian

if i remember correctly, you can change the size in General Option > Discussion

QuickOnlineTips
QuickOnlineTips

There is no option in wordpress admin to change avatar size.

Mi Kapa
Mi Kapa

Thanks, that was what i was looking for!

Praveen
Praveen

Customizing wordpress is interesting…. thanks for this tutorial :)

Macaroni Schotel
Macaroni Schotel

Thanks for the tips. I will use them to change my avatar

Javi
Javi

Thank you very, very much! I’m new to WordPress but this tutorial was super easy to understand and apply. I don’t know why the default avatar size has to be so small…

Filip Klar
Filip Klar

Thank you for your post. I was looking for this option in the CSS style very long ;) And it’s so easy.

Adewumi Adegboyega
Adewumi Adegboyega

oh great info,thanks so much on this