As we continue to gear up for WordPress 2.5, have you gotten your theme ready for Gravatars? In the past it required plugins, but now WordPress 2.5 has built-in Gravatar support. This means going forward, themes can easily be released with Gravatars built-in to the theme because no plugin will be required.
So, you’ve got WordPress 2.5 installed and you’re ready to assign Gravatars to your comments? All you need to do is a quick code hack to the comments loop where you want the Gravatar to show up:
<?php if(function_exists(’get_avatar’)){ echo get_avatar($comment, ‘50’);} ?>
I encourage everyone to support WordPress by displaying Gravatars on their blogs once you’ve upgraded to WordPress 2.5.



Tuesday, March 25th, 2008 at 5:34 am
Thanks for that.
What about placing it anywhere outside of the comments loop? I’d like to put it on my index page, in a header, close to the navigation menu, for example..
Tuesday, March 25th, 2008 at 7:57 am
Since you asked, I have modified by theme to include them at:
http://www.macnightowl.com
Peace,
Gene Steinberg
Tuesday, March 25th, 2008 at 8:24 am
@ Bardo - You should be able to use the code wherever you want to display a Gravatar, as long as there is an e-mail address assigned to the post/sidebar, etc. (Like an About Author section, etc.)
@ Gene - I checked it out and it looks great!
Tuesday, March 25th, 2008 at 8:34 am
Thank you. It took all of a minute or so add the code to each of my comments files (the site is made up of two integrated blog installations). And I don’t speak PHP.
Peace,
Gene
Monday, April 7th, 2008 at 5:03 am
I’m Vietnamese. I don’t speak well English.
Can you help me ? I don’t know.
Where can i place code ? in comment.php? i want it’s showed in right comment same you
and code of recent comment in your sidebar is great. Can you share it ?
Tuesday, April 8th, 2008 at 1:28 pm
@ Wow - Yes, place it within your comments.php file wherever you want it to display. If you dig through the code, you should see some things you recognize from your comment layout, so that is an easy way to figure out where to place the code. You may have to experiment until you’ve got it in the right spot.
Saturday, April 19th, 2008 at 8:52 am
Sounds so easy to do, but after 30 minutes of trying I still couldn’t get an gravatar image to show up in my blog’s comments. I tried putting the code from this post in a whole lot of different spots in the comments.php file but all it did was cause my post to show no comments at all and not load right.
Can someone pin point exactly where in the comments.php file this code goes? I have the WordPress Theme Almost Spring.
By the way, what WP plugin are you using for your email notify of comments. Thanks!
Thursday, April 24th, 2008 at 5:35 pm
Let’s me tested and give you a feedback
Thursday, April 24th, 2008 at 6:47 pm
Is there a WordPress Plugin that put this text:
[Want automatic updates? Subscribe to our RSS feed or Get E-mail Updates Automatically!]
At the bottom of each post? What is the name and the URL where I can get it and does it work with WP2.5?
Thanks!
Monday, May 5th, 2008 at 8:05 pm
For anyone having trouble (like me) adding gravatar images to their comments. I went and installed the WordPress plugin…
Easy Gravatars
http://wordpress.org/extend/plugins/easygravatars/installation/
Easy Gravatars 1.2
http://dougal.gunters.org/
Add Gravatars to your comments, without requiring any modifications to your theme files. Just activate, and you’re done! By Dougal Campbell.
—-
Now I have gravatars images, yea!
Sunday, May 18th, 2008 at 5:41 am
It’s one of the great function of WP 2.5. I love it too and thanks for sharing knowledges!
Sunday, June 1st, 2008 at 4:08 am
Gracias por la informacion, pero ¿como puedo crear un avatar?
Thursday, June 19th, 2008 at 11:55 am
It shows me an error when I insert that line of code you gave:
Parse error: syntax error, unexpected ‘)’ in /home/macamour…./comments.php on line 98
Monday, July 7th, 2008 at 1:40 pm
I uploaded a picture of me to my wordpress.com account, that I have my blog registered under. My wp.com profile has the same email address as the one I use everywhere. But my gravatar will never show up on any blog. My username for wp.com is hayesp could that effect anything?
Sunday, July 13th, 2008 at 4:55 am
Whew, been trying to find out how to do this. Gave it a try, and…well…it works.
Definitely adding this site to my WordPress-related bookmarks. I’ll be sure to post questions or so if the need arises.
Tuesday, July 15th, 2008 at 9:25 am
There is an error in that code. The ? after the 50 should be a single quote, not a ?.
Tuesday, July 15th, 2008 at 10:23 am
@ Dazz - Thanks. I have corrected the code in the above post. Hopefully that will fix any of the errors listed above.
@ Joni - That is the Subscribe to Comments plugin. Do a Google search and it should be the first one that shows up. The text I use at the bottom of each post is not a plugin, it is just basic HTML with a link to both subscription options. You can add it just below the content in your single page file.
@ Hayes - You need to sign up at Gravatar.com to get your Gravatar.
Saturday, August 23rd, 2008 at 1:52 pm
Thanks for your post..it’s work, thanks
Thursday, September 25th, 2008 at 9:24 pm
This is just awesome.You helped me a lot!Thanks.
Tuesday, October 28th, 2008 at 9:05 pm
Thank you very much for the awesome post. It’s really works!
Monday, April 6th, 2009 at 8:14 pm
i have tried several times but it is not workin…
Thursday, July 2nd, 2009 at 3:41 pm
Yo can easily put Gravatars anywhere, I use them in a drop-down nav menu - tutorial here - http://hygen.net/blog/?p=427
Trackbacks/Pingbacks
Leave A Comment
Become one of our
Featured Sites
Recent Trackbacks
Contributing Authors
Archives
Extras
WordPress Hacks Copyright © 2007-2009 | An Apricot Media Website
Template by StudioPress | Custom Design by Kyle Eslick and Blog Design Studio
RSS Feed Email RSS