Gravatar is Globally Recognized Avatar, It can be identified by your email address or ID in http://www.gravatar.com/.
The Great WordPress supported gravatar system above version 2.5, we can show the avator icon by the function get_avatar(); I patch my theme (comment.php) this afternoon, and let it supported the gravatar icon. if you wants your WordPress to support the gravatar, please follow the steps:
first, if you don’t have a gravatar, please sign up for one.
second, modify your comment.php in your /wp-content/themes/your_theme/comment.php and insert the function get_avatar(); .
for an example:
1 2 3 4 5 6 7 8 9 |
echo get_avatar( $comment, $size = '48', $default = 'url' ); // the $comment: just fill the prop. with the variable $comment. // the $size: max is 512 // the $default: the default image url, you also can adjust in from your control panel. |
WordPress also provided for backwards compatibility(from codex.wordpress.org):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
if (function_exists('get_avatar')) { echo get_avatar($email); } else { //alternate gravatar code for < 2.5 $grav_url = "http://www.gravatar.com/avatar.php?gravatar_id=" . md5($email) . "&default=" . urlencode($default) . "&size=" . $size; echo "<img src='$grav_url'/>"; } |
done! that’s it!
you can learn more at: Using Gravatars
by the way, if you want to test your gravatar, you may leave a comment above this post.
Test my global recognized avatar.
Yes, sign up an account, upload you “avatar”, and fill your email address when you post an article. then you waill see your avatar.
test, test for gravatar.