This article will detail how to add custom default avatars to your WordPress installation.
Many WordPress sites allow avatars in the comments section of pages and posts, but the default options are fairly limited.
Avatar settings for your WordPress installation can be found in Settings -> Discussion page once logged into the WordPress admin screen.
Once Avatar Display has been set to Show Avatars your site will now display the default “Mystery Man” avatar unless the users have set up a Gravatar logo.
Wouldn’t it be great if you could provide anonymous users with an avatar of your own design that matched the design of your site? Well here’s how…
You need to be familiar with your functions.php file in your WordPress theme. You can do it via the WordPress admin page and going to Appearance -> Editor and selecting the function.php from there, but I personally don’t recommend editing themes in this way.
My preference is to set up a development installation on your PC and then tinker with files on there using trusty old notepad (look out soon for an article on how to do this).
So, assuming you are happy editing functions.php, simply add the following piece of code and it’s job done.
function newgravatar ($avatar_defaults)
{
$myavatar = get_bloginfo('template_directory') . '/images/chicken.png';
$avatar_defaults[$myavatar] = "Chicken";
return $avatar_defaults;
}
add_filter( 'avatar_defaults', 'newgravatar' );
I’ve saved the new avatar image in my theme’s image folder and called it chicken.png but you can save it anywhere you like.
For my site I’ve called the default avatar “Chicken”, this is how it will display in the admin screen, but again you can call it anything you like.
As you can see from the screen shot on the left, the new default avatar can now be selected. Anyone now posting to my site that doesn’t have a Gravatar avatar will now display as a chicken (it’s nothing personal, I just have chickens in my site to brighten it up).
The avatar can be any size, that is dependant on your theme stylesheet configuration, but default sizes are 40px by 40px and I would recommend sticking with this size.

