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. User Avatar
    Ant

    Though you may use css for that.

  2. User Avatar
    Jacob
    Permalink to comment#

    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. User Avatar
    Celebrity Star
    Permalink to comment#

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

  4. User Avatar
    Jonas

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

  5. User Avatar
    Marcus
    Permalink to comment#

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

    • User Avatar
      Josh McClanahan
      Permalink to comment#

      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!

    • User Avatar
      Brad Dalton

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

  6. User Avatar
    YO MOMMA
    Permalink to comment#

    Will this work with .comments TD?

  7. User Avatar
    datta
    Permalink to comment#

    how i can change align of my avatars

  8. User Avatar
    LilyPut
    Permalink to comment#

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

  9. User Avatar
    Alex
    Permalink to comment#

    Mate, you’ve made my day!
    Cheers

  10. User Avatar
    Desi
    Permalink to comment#

    Thank you so much.

Submit a Comment

Posting Code

You may write comments in Markdown. This makes code easy to post, as you can write inline code like `<div>this</div>` or multiline blocks of code in triple backtick fences (```) with double new lines before and after.

Code of Conduct

Absolutely anyone is welcome to submit a comment here. But not all comments will be posted. Think of it like writing a letter to the editor. All submitted comments will be read, but not all published. Published comments will be on-topic, helpful, and further the discussion or debate.

Want to tell us something privately?

Feel free to use our contact form. That's a great place to let us know about typos or anything off-topic.

icon-closeicon-emailicon-linkicon-logo-staricon-menuicon-searchicon-staricon-tag