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.

Digg This! | Stumble it! | Add to Del.icio.us | | Print This! |

There Are 14 Responses So Far. »

  1. 1 bardo
    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..

  2. 2 Gene Steinberg
    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

  3. 3 Kyle Eslick
    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!

  4. 4 Gene Steinberg
    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

  5. 5 wOw!bloggiNE
    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 ?

  6. 6 Kyle Eslick
    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.

  7. 7 Joni Solis
    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!

  8. 8 Jauhari
    Thursday, April 24th, 2008 at 5:35 pm

    Let’s me tested and give you a feedback

  9. 9 Joni Solis
    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!

  10. 10 Joni Solis
    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!



Leave A Comment