1 Step Gravatars on your WordPress Blog

If you're new here, you may want to subscribe via rss -or- inspiration, psychology, blogging

Get Gravatars on your WordPress Blog in 1 step

No plugin required! Just one copy/paste in your comments.php file will make gravatars miraculously show up ( for commenters that have gravatar accounts) 1 step:

Directly before: <?php comment_text() ?>

paste:

<?php
if ( !empty( $comment->comment_author_email ) ) {
$md5 = md5( $comment->comment_author_email );
$default = urlencode( 'http://use.perl.org/images/pix.gif' );
echo "<img style='float: right; margin-left: 10px;' src='http://www.gravatar.com/avatar.php?gravatar_id=$md5&size=60&default=$default' alt='' />";
}
?>

SAVE changes.

Voila! You’re done. Easy as pie.

Let me know when you’ve done it and I will head over and test it.


Related posts

Tags: , , , ,

RSS feed | Trackback URI

3 Comments »

Comment by no imageNick Mercer (Check me out!)
2007-11-26 13:00:49

Nice and easy!  :-)   Thanks for posting this, I’ll have to add this into my blog. 

 
Comment by no imageMarcia (Check me out!)
2008-02-02 08:30:05

I added it on Tumbled Words, it was a cinch,  and it worked, one of your old comments showed your face! Adding it to the rest, thank you, Damien! Now to decide on a Gravatar image, that is the hard part for me.

Marcia’s last blog post..Gravatars, Anonymity, and Life

 
Name (required)
E-mail (required - never shown publicly)
URI
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.

Trackback responses to this post