Image Credits: brtsergio/ Flickr.
When a reader comments on your blog, a small image is displayed next to his/her name. It’s either a local Avatar or a Global Avatar (Gravatar).
If you are confused between these two terms: avatar and Gravatar, Here is a brief differentiation between the both:
An avatar is an image associated with a community user to differentiate him/her with others, its like an identity mark. When you register on a community site you upload an image, which is displayed in your profile or at place where you perform any activity. This avatar is limited with only the website where you uploaded your image. For eg. Facebook, your Facebook profile picture is your avatar on Facebook, which is displayed where ever you do any activity on Facebook. And its limited to Facebook only, you cannot bring it to use anywhere else.
Web consists of million of websites, it is not possible for a user to again and again upload an image to each of the website where he takes part in any discussion. To solve this problem concept of a global avatar (Gravatar) was introduced.
Gravatar is a globally recognized avatar, you can go to gravatar.com and attach an image with your email id. Later whenever you will use that email id to take part in any discussion on Gravatar enabled website your Gravatar will be displayed.
Here is a step by step procedure on How to get a Gravatar.
Now back to the topic of this post, Adding a New Default Avatar to WordPress:
When you comment on any blog your Gravatar is displayed and if you do not have any Gravatar set on your email id a default avatar image, as specified by the blog administrator is displayed. WordPress has a limited set of default avatar images and has no option to assign a new image as default avatar. so in this post I’ll tell you a trick using which you can assign a new image of your choice as the default avatar to your WordPress installation.
Procedure to Add a New Default Avatar to your WordPress Blog
1. Upload the image which you would like to use as default avatar to your hosting space. Keep the size of image as 64×64 pixels. For eg, I made the following image a default avatar on this blog.
2. Add the following code to your theme’s function.php file.
if ( !function_exists('fb_addgravatar') ) {
function fb_addgravatar( $avatar_defaults ) {
$myavatar = 'Image url';
$avatar_defaults[$myavatar] = 'Avatar name';
return $avatar_defaults;
}
add_filter( 'avatar_defaults', 'fb_addgravatar' );
}
Reach the file via ftp or you can also use the WordPress editor to edit the file, but I’ll recommend you to do it via ftp.
3. Replace the ‘Image url‘ with url of your image. and ‘Avatar name‘ with any name you would like to assign to the new avatar.
4. Save the changes.
You are done. Goto discussions page under setting tab in dashboard. Your new avatar now must be listed in the list.
If you experience any problem, feel free to put it in the comment box below.