Posts Tagged ‘Gravatar’

1 Step Gravatars on your WordPress Blog

Monday, November 26th, 2007

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