Grow your CSS skills. Land your dream job.

Last updated on:

Change Avatar Size

The wp_list_comments function has a parameter to change the default (48px) size to anywhere between 0 and 80px.

wp_list_comments('avatar_size=80');

Comments

  1. Though you may use css for that.

  2. CSS is going to scale the img, which will pixelate it. This technique fetches an img sized the way you want it, which is the better way to go.

  3. I wish I’d found this site before, there is great information. I was looking for this code

  4. Jonas

    Ahh.. so easy… why didn’t i get this two weeks earlier :)

  5. Marcus
    Permalink to comment#

    Where does this go? In CSS? In comments.php? Somewhere else?

    • You would place this in the function that is displaying your comments. (In comments.php)
      Example:

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

      Good luck!

    • No. You’d place this code in a custom function in your child theme otherwise you’ll lose it when you update WordPress.

  6. YO MOMMA
    Permalink to comment#

    Will this work with .comments TD?

  7. datta
    Permalink to comment#

    how i can change align of my avatars

  8. I spent so much time trying to figure the resize out. Thank you for your help, Josh!

  9. Alex
    Permalink to comment#

    Mate, you’ve made my day!
    Cheers

  10. Desi
    Permalink to comment#

    Thank you so much.

Leave a Comment

Posting Code

Markdown is supported in the comment area, so you can write inline code in backticks like `this` or multiline blocks of code in in triple backtick fences like ```this```. You don't need to escape code in backticks, Markdown does that for you.

Sadly, it's kind of broken. WordPress only accepts a subset of HTML in comments, which makes sense, because certainly some HTML can't be allowed, like <script> tags. But this stripping happens before the comment is processed by Markdown (via Jetpack). It seems to me that would be reversed, because after Markdown processes code in backticks, it's escaped, thus safe. If you think you can fix this issue, get in touch!

If you need to make sure the code (typically HTML) you post absolutely posts correctly, escape it and put it within <pre><code> tags.

Current ye@r *

*May or may not contain any actual "CSS" or "Tricks".