Now serving Gravatars

WordPress 2.5 and later have built-in support for Gravatars — site-independent avatars. They’re basically small pictures that can appear next to your comments across multiple sites, depending on the email address you registered with the main Gravatar site.

I hadn’t gotten around to hacking the theme I’m using–which apparently predates WP 2.5–for Gravatar support, but (per the Codex) adding the support was trivial. I added this line of code in the comments loop and was all set, aside from some trivial additions to the CSS to display the gravatar in the right place:

echo get_avatar( $comment, $size = '48' );

You can see what it looks like below. And if you sign up with the service, when you leave a comment on my blog your avatar (G-rated only–my blog policy enforces it) will appear next to your comment. Nice trick.

One thought on “Now serving Gravatars”

Leave a Reply

Your email address will not be published. Required fields are marked *