Posted on 13 October, 2008 By Kim Woodbridge 27 Comments

How to Customize Gravatars in WordPress

Yesterday I decided to edit the gravatar settings for the images in my comments. I wanted to make the gravatars smaller and use a custom image for commenters who don’t have one rather than the default gravatar image.

I use the gravatar plugin and the following code is in my comments template file. You will want to locate this code in your comments template, if you want to make any of the same edits.

 

<?php gravatar(); ?>

There are 4 conditions that can be used with the gravatar code; rating, size, alternative image, and border.

Gravatars have ratings similar to movies. If you want to show gravatars that are rated not higher than R, you would put R in the conditions and everything rated R and below will show up in the gravatars. I’ve never seen gravatars rated higher than than that but maybe I don’t visit those sites.

The default size of the gravatar is 80×80. This is what the size will be if you don’t put anything in the conditions. I thought this was too big, so I changed it to 50.

This is the default image that is used when a commenter doesn’t have a gravatar. I wanted to change it to a logo for my own site. I uploaded the image to my webhost and then added the path to it in the conditions for the gravatar code.

The final condition that you can set is a color for a 1px border. I decided not to add this.

The changed code now looks like the following:

<?php gravatar("R", 50, "http://www.kimwoodbridge.com/wp-content/
themes/kimwoodbridge/images/asd2.jpg"); ?>

On a side note, this is my 100th post. It’s hard to believe but here’s to 100 more.


Related Posts:
  • How to Link NextGEN Gallery Images to an Individual Page or Post in WordPress
  • WordPress: Missed Schedule for Scheduled Posts – A Plugin Fix
  • Using Thumbnails for Excerpts Plugin with Query Posts to Make a Custom Sidebar Block in WordPress
  • Using WordPress Custom Fields to Display NextGen Gallery Slideshows Conditionally
  • Random WordPress Quotes Without A Plugin
  • Posted In : WordPress Plugins | WordPress Tips
    If you enjoyed this post, please subscribe to my RSS Feed

    Post to Twitter   Post to Delicious   Post to StumbleUpon

    27 Responses to “How to Customize Gravatars in WordPress”

    Trackbacks/Pingbacks
    1. Links about Wordpress | Some things will never change
    2. How to Customize Gravatars in WordPress
    3. How to add our own default avatar? - DIY Themes Forums
    4. Be Social Get a Gravatar :: 3 Green Angels
    Leave a Comment
    You may use: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .


    Recent Comments

      • Juncai: Hi there, I was trying to add an image when i share to facebook. The code above for the link rel="image_src" href=”u...
      • Carla: Kim - I'm sorry for implying that anyone choosing (not because they cant pay or not eligible) to forgo insurance is irre...
      • Jamie Dunne: ~Hi Kim, Thanks for posting this - Great info ... Ive being digging through numerous apps and code trying to do th...
      • vered - blogger for hire: Thanks... and I love the photo. :) .-= vered - blogger for hire´s last blog .....
      • Kim Woodbridge: Hi Lisa Marie Mary - I think I remember that. And I never minded a mullet on Bono ;-)...
      • Kim Woodbridge: Hi Dot - We got about 2 feet - I think there was a lot more down your way. Schools were closed today, which I thought w...
      • Lisa Marie Mary: Yes, I know - I'm a mullet dork. I admit it. LOL I had my sweet little boys wear them for about their first 5/6 years -...
      • Dot: Oh, so that's what short codes are. Hope you're managing okay with all the snow. Are they good at cleaning it up in ...