WordPress Gravatar Configuration Tutorials

wordpress gravatar configuration

I have been playing with wordpress for very a long time and doing lots of customization on my site such as this web hositng review one. But I rarely pay attention to one important feature — Gravatar. After a bit research, I would like to share the knowledge I learnt.

What's Gravatar?

Here's the definition from gravatar official site:

"A gravatar, or globally recognized avatar, is quite simply an image that follows you from site to site appearing beside your name when you do things. Avatars help identify your posts on blogs and web forums, so why not on any site?"

For short, it's your head image when commenting on some popular blog systems like wordpress, blogspot etc. Even you're not blogging or commenting, when you visit some blogs you will find many beautiful pictures of commentors. That's because the Gravatar is enabled from wordpress admin panel. If you do not have a personal gravatar, it will pick from the system default settings.

How to get & use Gravatar?

In order to show up our personal gravatar, we have to register from the gravatar official site http://gravatar.com first. Once it's accepted our picture will be saved in gravatar system. But please note, during the registration we need to pick up a correct rating for the picture we uploaded (G, pg, R, X). Once submitted, it will be approved manually by their workers so please make sure to choose the right rating.

When we comment on a blog post and use the same email address from gravatar registration, our head image will be displayed. So the key point is the registration email address, it'll grab the picture from gravatar system directly.

As website admin, we can pick up a head image from system default ones directly. In case we don't like the system defaults and don't want to register with gravatar, we can add the following to functions.php of our wordpress theme.

//Make a new default gravatar available on the dashboard
add_filter( 'avatar_defaults', 'newgravatar' );
function newgravatar ($avatar_defaults) {
$myavatar = get_bloginfo('template_directory') . '/images/newImg.jpg';
$avatar_defaults[$myavatar] = "newImg";
return $avatar_defaults;
}

The '/images/newImg.jpg' is the gravatar you would like to use, we place in the images folder of wordpress theme. Once it's saved, we can login to wordpress > Setting > Discussion, the newly defined gravatar will be available there.

The wordpress gravatar codex documentaion: http://codex.wordpress.org/Using_Gravatars
Excellent wordpress gravatar plugin: http://wordpress.org/extend/plugins/wp-gravatar/
Recommended WordPress hosting provider: www.inmotionhosting.com