If you are like most of the other wordpress developers out there, then you might also had this problem with the default mystery man in wordpress. You also would wanted to change the deafualt avatar of your comments with something nice. It's not that hard. It's infact very easy.
Just add this to your functions.php file within your theme folder.
Happy coding! For any queries or suggestions give a comment below!
Just add this to your functions.php file within your theme folder.
/**
* add a default-gravatar to options
*/
if ( !function_exists('fb_addgravatar') ) {
function fb_addgravatar( $avatar_defaults ) {
$myavatar = get_bloginfo('template_directory') . '/images/avatar.gif';
$avatar_defaults[$myavatar] = 'people';
$myavatar2 = get_bloginfo('template_directory') . '/images/myavatar.png';
$avatar_defaults[$myavatar2] = 'wpengineer.com';
return $avatar_defaults;
}
add_filter( 'avatar_defaults', 'fb_addgravatar' );
}
Why this? When you can have this! |
Happy coding! For any queries or suggestions give a comment below!
Comments
Post a Comment