How often does it happen that you see a ‘ Mystery Man’ or inbuilt avatar’s for comments and posts of users who have not added their picture on gravatar, I am sure you see it a lot. Why not display your blog symbol or something which you like for avatar’s than inbuilt ones.
Well follow these steps to set your default avatar:
Steps
- Create your own Avatar 100 X 100 size
- Save the file
- Put the image in Images folder of your current theme (Or else get the URL address of where you store it)
- Open Functions.php of your theme via FTP or wordpress
- Put this code in functions.php of your theme
- // Custom Avatar code
if ( !function_exists(‘addgravatar’) ) {
function addgravatar( $avatar_defaults ) {
$myavatar = get_bloginfo(‘template_directory’).’/images/default.jpg’; //=> Change path to your custom avatar
$avatar_defaults[$myavatar] = ‘Custom Avatar’; //=> Change to your avatar name
return $avatar_defaults;
}
add_filter( ‘avatar_defaults’, ‘addgravatar’ );
}
- Login as admin in wordpress
- Go to Settngs—–>Discussion
- Choose your custom default custom avatar in it
- Click save changes
Now you will start seeing your custom default avatar. If you have any questions please feel free to post it through comments.
Comments are always appreciated!!
Do Promote the post if you liked it!!
No comments:
Post a Comment