How to Use Gravatars in WordPress and Beyond

gravatar logo

We all like to see pictures of ourselves. It’s part of how we’re wired. We’re visual creatures. Somehow just seeing an image of someone else makes it easier for us to communicate with them and have a stronger connection.

Not only that, but using a consistent image to represent yourself around the web can help improve your branding. Using a Gravatar is an easy way to do that. Easy and free (I like free!)

gravatar logoThe name Gravatar came from Globally Recognized Avatar. An avatar is simply an icon or an image that represents a computer user. Using Gravatars is really very simple. Since version 2.5, Gravatar support has been built into the core WordPress functionality.

And even though the service is owned by Automattic (the same company that develops WordPress) it is fairly easy to implement in all sorts of other platforms too! Check out the Gravatar Implementation page to see how to use Gravatars with platforms like Blogger, MovableType, Drupal, Joomla, LiveJournal, Ruby on Rails, Cold Fusion, Pearl, Python, ASP… And the list goes on.

Gravatar as a Commenter

The easiest way to use Gravatars is as you are commenting on Gravatar enabled blogs. Simply go to the Gravatar website and click the link at the top to Sign Up.

The site will ask for your email address which you will have to validate. Once you do you can add your image from either your computer’s hard drive, web cam, or a web URL where your image is already online.

One thing to keep in mind is that you will want to crop your image to be square, which you can do after uploading the image, to keep it from distorting when it is displayed as a square image around the web.

Your Gravatar will then be married to your email address so that whenever you use that address on any Gravatar enabled web site your image will be shown automatically. That’s all you have to do. Piece of cake.

If you have multiple email addresses, you can even set up a different image for each one. Then choosing which image to use is as easy as entering a different email address.

Displaying Gravatars in Your Blog’s Comments

Displaying Gravatars in your blog’s comments is easy too with WordPress versions 2.5 and later. The first thing you will want to do is make sure they are turned on.

To do this click on the “Settings” menu and then choose the “Discussion” option.
Click image for larger view

Then scroll down the page to the “Avatars” section to adjust your settings.

Click image for larger view.

Here you can turn your Avatars on or off, set what rating to show and choose the default Gravatar to display on your blog. The three “Generated” default Gravatars will generate a random image based on the email address the user inputs.

Don’t forget to click the “Save Changes” button at the bottom after you have the settings the way you want them.

If your WordPress theme is Gravatar enabled then that’s all you need to do and you are good to go.

Getting Technical

(The rest of the post gets into coding and php. If you are not familiar with all that, feel free to stop reading and don’t feel bad. Most users won’t need to mess with any of this stuff anyway.)

WordPress will automatically call up the Gravatar as part of the wp_list_comments function. For example, if you wanted to just list comments (without trackbacks or pingbacks) with a Gravatar size that’s 48px square your comments.php file should have the following code in it:

<?php wp_list_comments('type=comment&avatar_size=48'); ?>

You can adjust the size to fit your theme or omit the type if you like.

Displaying Gravatars for Multiple Authors

If you have a blog with more than one author you can display the author’s gravatar as an easy way to let your audience know which one wrote any given post.

There are a couple of different ways you can do this but they both use the get_avatar WordPress function.

Since Gravatars are tied to email addresses you can use the author’s email to display the Gravatar with this bit of php code in your loop:

<?php echo get_avatar( get_the_author_email(), '80'); ?>

Where the number ’80′ is the size of the Gravatar. Simply change that out with whatever size fits your theme.

You can also use the author’s ID number that is assigned by WordPress in the get_avatar function instead of the author’s email if you’d rather. Here’s how that code looks:

<?php echo get_avatar( get_the_author_ID(), '80'); ?>

Either way should give you the same results.

Styling with CSS

The other piece needed to display Gravatars correctly, whether in the post area or in the comments is some styling. WordPress automatically adds a couple of classes to the html output to make things easier for you.

These classes are .avatar and .avatar-$size where “$size” is whatever avatar size you have set to display. So in the examples above the second class would be .avatar-48 and .avatar-80 respectively.

Using different size avatars for the author images in the posts and for the comment Gravatars can be one easy way to style them differently because of the different classes that WordPress assigns to the different classes.

Bottom Line

The bottom line is Gravatars are a very simple way to add a bit of personalization to your blog that can help foster conversation and build relationships.

With WordPress it’s nearly automatic these days and because the Gravatar system is so simple it is even easy to impliment in other applications beyond WordPress. Since it Gravatars are so easy to use, using them seems like a no-brainer to me.

Related Posts with Thumbnails
68 Responses to How to Use Gravatars in WordPress and Beyond
  1. Bruce > The Hockey Writers
    April 17, 2009 | 4:44 pm

    We have a blog with 34 writers so having a face on them is important. We are just now implementing the use of Gravatars throughout the site and are very pleased with the service.

    • Chris
      April 18, 2009 | 11:49 am

      Bruce, with a mulit-author blog like yours, Gravatars are a great way to help your audience connect with your authors.

  2. Robb
    April 18, 2009 | 2:59 pm

    Personally, I like the Gravatar concept, and have implemented it on a few of the blogs my customers have recently had tweaked.

    Perhaps I’m not the sharpest knife in the drawer, but I found setting up a Gravatar (on their site, not on the blogs) was a bit of a pain, as was finding my Feedburner ID when setting up there. I guess like most things it gets easier with practice…

    Thanks for sharing these types of tips, very handy stuff :)

  3. Timon Weller
    April 19, 2009 | 2:28 am

    Gravatars are an awesome addition to any wordpress comment system. I find it encourages way more comments and creates way more professional interaction.

  4. Liftchair
    April 20, 2009 | 8:30 am

    I recently installed Gravatar here on the Laughing Squid blog. Gravatars are those cool avatars you see next to people’s comments. They help you maintain a consistent identity across blogs by providing a global avatar. They are really simple to setup and use.

  5. Decor South Furniture
    April 21, 2009 | 4:38 pm

    thanks for the gravatar tip!

    testing out our new gravatar with this comment (fingers-crossed).

  6. almir
    April 21, 2009 | 11:49 pm

    i totally agree with you by using a gravatar its a better way to communicate with someone with a more personal level as when you see their picture its like your showing more trust while the people that don’t reveal their identity are more of the shady individuals

  7. Cool Gifts
    April 22, 2009 | 2:11 pm

    Great tutorial. Using a gravatar is a great way to brand yourself and your business. I will definitely be adding an image in my wordpress admin.

  8. Jared Stenzel
    April 22, 2009 | 8:34 pm

    Got mine up :D It makes our comments look so much less like spam, even if they are. I’m going to be looking at getting a picture of myself in my comments soon just to make them look even better. Thanks for the tutorial!

  9. Cheap cars
    April 23, 2009 | 2:44 am

    This is very nice post on, “how to use gravatars on wp blog”.

    ==> Peter

  10. Lisa
    April 23, 2009 | 11:52 pm

    I’d been wondering how people got those cute little pics by their comments. I followed the link and signed up. You are officially the first sight I’ve commented on with my new gravatar.

  11. 3d en güzel oyunlar
    April 24, 2009 | 12:07 am

    I recently installed Gravatar here on the Laughing Squid blog. Gravatars are those cool avatars you see next to people’s comments. They help you maintain a consistent identity across blogs by providing a global avatar. They are really simple to setup and use.

    yes…

  12. Darlington Web Design
    April 25, 2009 | 8:15 am

    Thanks, looks easy when you know how! I think I’ll be adding them to my work blog, although there’s probably not that many users who actuially have one!

  13. Jack Smith
    April 25, 2009 | 2:08 pm

    I accidently stumbled across your blog but I liked it a lot. Keep up the good work.

  14. SEO Consultant India
    April 25, 2009 | 2:10 pm

    It was great to go through the stuff posted on your blog. Look forward to more useful posts in future.

  15. Gume
    April 26, 2009 | 4:36 am

    Man, you have great tips for internet marketing. I especially liked your Twitter post a couple of days back.

  16. Brian
    April 26, 2009 | 11:26 am

    Very cool idea. I find that depending upon the blog i post to, i may want to use a different image – based on whether it’s for business or personal. I assume we can setup more than 1 gravatar?

  17. Music News
    April 27, 2009 | 6:25 am

    Gravatars are funny but I think that they’re only useless gimmicks. It’s about the content (also in the comment for a blog) and for that reason it should be more important to do something in that case!

    • dental products
      May 25, 2009 | 9:06 pm

      The author have stated the advantages of using gravatar and I don’t think its a kind of useless gimmicks. I hope you’ve got the idea.

  18. Vlad
    April 27, 2009 | 3:53 pm

    I especially like using Gravatars because they don’t rely on a cookie installed on your PC, but simply on your registered email address.
    If you registered on Gravatar with an email for fun and another email for business, just comment using that email and the Gravatar will be there. No cookies, ips and other methods of tracking…

  19. Amit
    April 27, 2009 | 4:50 pm

    This is something I need to implement for all our blogs.

  20. Talia Phillips
    April 28, 2009 | 6:28 am

    This is something I haven’t had a chance to implement in my blogs yet either. It definitely makes sense as far as branding goes and they do make everything instantly more personal and us bloggers more personable.

  21. forex
    April 28, 2009 | 10:10 am

    Maybe the question is stupid, but are the those Gravatars are available in MU Wordpres blogs

  22. Jacksonville Realtor - Brad Officer
    April 29, 2009 | 5:41 pm

    Finally got my Gravatar set up thanks to some pushing from Chris. Glad to see me!

  23. musica
    April 30, 2009 | 2:48 pm

    Gravatar is a cool adition for blogs

  24. Roselyn | Nuviderm Tattoo Removal
    May 1, 2009 | 8:10 am

    I’ve been wanting to see my Gravatar but I haven’t figured out how to get one. I’m glad I found this blog. Thank you for the very useful tips and complete guide. Hopefully I have Gravatar the next time I visit here :)

  25. Travis
    May 1, 2009 | 11:35 pm

    Good information. I was going crazy not being able to figure out how to change my gravatar!

    Thanks!

  26. Inchirieri Masini
    May 2, 2009 | 2:42 pm

    gravatars are indeed great and i love mine. They connect words with images. My avatar is as you can see a car :)

  27. Inchirieri Masini
    May 2, 2009 | 2:43 pm

    Sorry i misspelled my email now it should appear

  28. Vasilescu
    May 4, 2009 | 7:03 am

    Good and nice explanation. I tried once to change gravatars to my wordpress, but now with these explanations is much easier. Thanks

  29. Vanessa
    May 4, 2009 | 9:20 am

    I too have never heard of gravatars before this post. I can see how it provides a more personal commenting system.

  30. Jenna
    May 5, 2009 | 7:09 am

    i love gravatars, it give more colors to blogs :)

    • Troy
      July 17, 2010 | 4:26 pm

      And having a very beautiful image like yours for your gravatar is always good too!

  31. Aldohas Personal Development
    May 10, 2009 | 7:09 pm

    I’m using wp-gravatar plugin
    good enough

  32. as400
    May 12, 2009 | 2:22 am

    good post, but I tend to just stick to the default avatar!

  33. John Thomson / Web Hosting Art
    May 12, 2009 | 11:39 am

    Gravatars, as very clearly mentioned, are giving to content a more personalized touch. A 48px × 48px jpeg graphic file is enough to offer the sense that we are interacting with another human. I think that Gravatars are one of those little, simple inventions that enhance the communication and interaction between Internet users.

  34. Shanghai Blog
    May 16, 2009 | 2:29 am

    I’m glad I don’t need to use wp-gravatar anymore! The cartoons also look good (although some people might not like them on their site if it doesn’t fit with the theme).

  35. Paulo Pires
    May 16, 2009 | 6:21 am

    Excellent Post. Thanks

  36. Bruce Means
    May 16, 2009 | 9:29 am

    Just wanted to say thanks for the useful information.

  37. Bioidentical Hormones Louisiana
    May 18, 2009 | 9:27 am

    I really do need to get my Gravatar set up.

  38. lidagazeteler
    May 18, 2009 | 11:59 am

    Wordpress’te kendi avatarlar?m?z? kullanabilir miyiz? WordPress’in böyle bir özelli?i olsa çok daha güzel olur bence.

  39. MR Valeting
    May 18, 2009 | 3:46 pm

    Gravtars are great for blogs. I noticed that vivvo (publishing CMS) uses gravtars too so I guess the word is spreading fast.

  40. Shaon
    May 19, 2009 | 2:54 am

    Thanks for the tutorial. This solved a issue for me in my blog :)

  41. WebMaster
    May 20, 2009 | 3:11 am

    Great tutorial. Using a gravatar is a great way to brand yourself and your business. I will definitely be adding an image in my wordpress adminc yes

  42. yasinta
    May 21, 2009 | 6:01 am

    I use gravatar too. It’s so easy and practical. I can change my gravatar any time I want, and it turns out automatically each time we leave comment. Support narcism, lol…. !

  43. chin surgery
    May 21, 2009 | 11:31 am

    gravatars is worth much more than I paid. gravatars did exactly what you said it does. It fits our needs perfectly.

  44. Greg
    May 24, 2009 | 6:38 am

    Thank you for your tutorial. I was trying to implement Gravatar on my old wp blog, but failed. Recently I have updated to wordpress 2.7.1 and was surprised to find Gravatar as a built in function.

  45. Eric
    May 27, 2009 | 6:13 pm

    Well, this is certainly a reason for me to upgrade our WordPress. Even if the public doesn’t do it, it at least makes it more fun for employees who post. Or for the public to see what the employees look like. I love the idea.

  46. Foodnut
    May 28, 2009 | 12:16 pm

    Don’t forget to first make JPG, GIF, or PNG image that your gravatar will be, before you setup a new gravatar. Keep the size under 10k

  47. Drifin
    June 1, 2009 | 11:43 am

    Never heard about gravatar before this post. But it sound like something very fun and give more colours to a blog. Thanks for the knowledge.

  48. Lifted trucks
    June 2, 2009 | 2:26 am

    Yeah i am already used my gravatar…

    Gravatars are indeed gr8 nd i love mine… They connect words with images…

  49. jlbraaten
    June 4, 2009 | 2:56 pm

    You’d think more people that posted comments would have gotten Gravatars given the nature of your post.

  50. Yuva
    June 5, 2009 | 4:31 am

    Can we use the favicon as the Gravatar. Will it work?

  51. Frugal Shopping Ideas
    June 6, 2009 | 1:20 am

    The default gravatars look pretty bad. I’d prefer users have their own custom gravatars.

  52. Trail Running Blog
    June 6, 2009 | 1:21 am

    Gravatars are a great way for commentors feel like they have more customization and uniqueness.

  53. Adam Alfia
    June 10, 2009 | 1:29 pm

    I recently setup my Gravatar for my work e-mail and have enjoyed the ease of functionality across the various Gravatar enabled sites. It’s a wonderful centralization/implementation of a universal electronic necessity — to have a picture of one’s self on hand at any time!

  54. Marton Criação
    June 10, 2009 | 2:49 pm

    Useful information. Previously I had problems with this issue.

  55. Fotoframkallning
    June 11, 2009 | 5:35 pm

    Oh, that was a really nice service that gavatar provides. I’m really going to use that on my main blog that for sure and going to use your 100% guide to get it to work!

    Thanks for nice guides!

  56. Gochi Juice
    June 14, 2009 | 12:33 pm

    I activated the plug-in on my blog, but unfortunately, it doesn’t look all that great…. :o ( I use a blog theme that has a comic type comment that the Gravatar picture overlaps and doesn’t have great appeal…. But, my picture is going to spice up my comments on others blogs that us Gravatar!!!!

    Thanks again for the great informative post….

  57. Lenny
    June 16, 2009 | 12:29 pm

    I really like the idea of Gravatars. I’m glad that Automattic is providing such a great service that it can be incorporated into projects outside of WordPress as well.

  58. WebMaster
    June 18, 2009 | 10:20 am

    that was a really nice service that gavatar provides. I’m really going to use that on my main blog that for sure and going to use your 100% guide to get it to work!

    Thanks for nice guides!

  59. Mark Edison
    June 20, 2009 | 3:07 pm

    Just to make sure, they do not work in joomla right?

  60. eclipse
    June 29, 2009 | 1:44 am

    Thx for your guide, sometimes gravatar ruined my layout, after read this article, maybe i can fix the problem after read this article..

  61. web development
    July 6, 2009 | 1:12 pm

    I have found that I use facebook for email now, just because there is a littel picture fo the person I am emailing. The simple act of posting a photo really makes a difference in terms of accesiobility. Guess I need to get a gravatar! Thx for the post!

  62. Zhu
    October 4, 2009 | 11:12 pm

    I love Gravatar and keep on wondering why don’t more people sign up. I mean, it’s so easy and convenient… especially considering plenty of others website where you have to go through a weird registration process.

    I encourage people to sign up on my blog and I’m surprised to see a lot of people don’t.

    A personalized Gravatar does make a difference.

  63. Anda Romania
    December 22, 2009 | 5:02 am

    I totally agree with you by using a gravatar its a better way to communicate with someone. Thank you for your tutorial!

  64. Anton Romanov
    March 5, 2010 | 6:49 am

    Thank you! I long ago wanted to know how to use Gravatars on my site! Comments with Gravatars Pictures look very beautiful!

  65. Pekka S
    July 8, 2010 | 12:13 pm

    Thanks!

Leave a Reply


Wanting to leave an <em>phasis on your comment?

Trackback URL http://successcreeations.com/1144/how-to-use-gravatars-in-wordpress-and-beyond/trackback/