ok..users tend to drawed to using either gravatar or mybloglog avatar to implement an identity to the commentator..what if you want to used or switch from gravatar and mybloglog without any hassle. Here’s a simple integration you can input into your comment loop.
Using original source from gravatar integration Tip #6: Add Gravatars Without a Plugin from WPDesigner by Milo
Implement Method In Comment Loop
- <?php if(function_exists(“MyAvatars”)) : ?><?php MyAvatars(); ?><?php else: ?>
- <?php $pathtotheme = get_bloginfo(‘stylesheet_directory’); ?> <!– this is so you can input your own site no-avatar image rather than default one from gravatar –><?php if(!empty($comment -> comment_author_email)) {$md5 = md5($comment -> comment_author_email);$default = urlencode(“$pathtotheme/images/no-avatar.gif“);echo “<img src=’http://www.gravatar.com/avatar.php?gravatar_id=
$md5&size=48&default=$default’ alt=’commenter’ />”;}?> - <?php endif; ?>
that’s it..easy right. Bold text in code above are editable according to your images location and avatar size. In order to make the gravatar and mybloglog avatar size the same, open your style.css and add this line to bottom of your css or any location you desired
- img.MyAvatars
{
height: 48px;
width: 48px;
}
change the bold height and width to the same dimension size as your gravatar.