Adding a new avatar image to the default wordpress avatar called mystery man was always a new bloggers problem, Follow our tutorial and choose avatar which is more suitable to your theme.
Open your theme’s functions.php file and add this new function.
add_filter( 'avatar_defaults', 'newgravatar' );
function newgravatar ($avatar_defaults) {
$myavatar = get_bloginfo('template_directory') . '/images/my-gravatar.jpg';
$avatar_defaults[$myavatar] = "My Avatar";
return $avatar_defaults;
}
We are done. Using the add_filter function we changed the avat_default function a little bit, with newgravatar function. We added our new avatar in default wordpress avatar list. Change my-gravatar.jpg with your own. This file must be located in /images/ folder of your theme.
Now in order to change your default avatar go to Settings>Discussion and choose your image.
Cheers, Joshu
Loading...
|
||||