By default wordpress has some profile photos. In this tutorial we will show to you to Add custom gravatars to your wordPress default gravatar list.
custom gravatars to your wordPress
Just copy paste following code to functions.php file. This file can be found in your current activated theme folder.
if ( !function_exists('fb_addgravatar') ) { function fb_addgravatar( $avatar_defaults ) { $myavatar = get_bloginfo('template_directory').'/images/avatar.gif'; //default avatar $avatar_defaults[$myavatar] = 'people'; $myavatar2 = get_bloginfo('template_directory').'/images/myavatar.png'; //Avatar for user "admin" $avatar_defaults[$myavatar2] = 'admin'; return $avatar_defaults; } add_filter( 'avatar_defaults', 'fb_addgravatar' ); }
Thanks to WpEngineer for this such great wordpress hack!
I found useful following articles for wordpress plugin developers.
http://codex.wordpress.org/Using_Gravatars
http://codex.wordpress.org/Function_Reference
http://codex.wordpress.org/Function_Reference/add_filter
http://codex.wordpress.org/Plugin_API/Filter_Reference