Gravatars: Revisted
Back in April I showed you how to add Gravatar support to your WordPress blog (see Gravatars) but after re-reading that article a few times I came to the realization that perhaps it was a bit too difficult for novice users to grasp. After further research and much trial and error I'll now present what I feel is a much more simplified way to accomplish this. Keep in mind that this only applies to themes that don't have the functionality already built-in. Obvious I know but worth mentioning nevertheless.
Step 1: Open comments.php in your favourite plain text editor (notepad will work just fine) and look for the following line ...
<?php comment_text() ?>
... and replace it with this ...
<div class="gravatar">
<?php if (get_bloginfo('version')>=2.5)
echo get_avatar( $comment->comment_author_email, $size = '50', $comment->comment_author_link);?>
<?php comment_text() ?>
</div>
<br clear="all" />
Step 2: Now we need to add the styling for your new Gravatars in the style sheet. Open style.css in your favourite plain text editor and add the following ...
.gravatar {margin-top:20px;}
.avatar {float:left; border:1px solid #BBBBBB; padding:3px; margin-right:5px; margin-bottom:5px;}
Step 3: Upload the modified files using your favourite FTP client. (I always recommend working with files offline and uploading rather than using the built-in theme editor.)
Of course the styling attributes you use may vary from theme to theme but this is a starting point. Experiment away.


I wish I could add a gravatar template tag to my site
I hear through the grapevine Google will be offering Gravatar support for Blogspot in the not-so-distant future.