Gravatars are in 2.5 by default and how to use them is in the default theme as well, but they will not be enabled in your older custom themes until you do so.
Here’s what I did to enable them in mine. You can use this as an example, to get an idea of how to do it.
Basically, I wanted them to show up next to the comments. So I edited my comments.php file. First I found this code in it:
<cite><?php comment_author_link() ?></cite> Says:
That prints the “Otto says:” bit in my comment. Just in front of that, I added this:
<?php if (function_exists('get_avatar')) : ?>
<a href="https://gravatar.com">
<?php echo get_avatar($comment, 40); ?>
</a>
<?php endif; ?>
Like most themes, my theme used “$comment” as the variable for the individual comment. Look for code like this in the file: foreach( $comments as $comment ) {
. The $comments name is set by WordPress, but the individual $comment name is determined by the theme. $comment is the usual case.
And the “40” is the size I wanted the avatar to be, in my theme. 40 pixels was derived by experimenting with different values until I liked it.
Also note that I made the avatar link to gravatar.com. I did this so that if somebody clicks on the avatars, they will discover how to get their own. So if somebody leaves a comment and sees their avatar is the default, then clicking on it will lead them to a place where they can create an avatar for themselves to see.
Now, this put the avatar in there, but the text was screwy. My comment didn’t flow around it properly, and didn’t leave enough margin space. But, I discovered that the get_avatar function adds a class of “avatar” to what it produces. So styling it was easy, by adding this to my stylesheet:
.avatar {
float:left;
padding: 3px;
margin-bottom: 5px;
}
The float:left makes text wrap around it properly, and the padding and margin makes the text stand away from it a little bit. Again, experimentation helped to determine how I wanted this to work.
And that’s it. It’s pretty easy if you know where you want it to be. No need for a plugin, just a minor bit of theme editing.