You can add your own image to the default list of avatars listed in Dashboard —-> Settings —-> Discussion….


I came across this code and it works perfectly. Add the following code to your custom_functions.php file…
/*add avatar to wordpress default list*/
add_filter( ‘avatar_defaults’, ‘newgravatar’ );
function newgravatar ($avatar_defaults) {
$myavatar = get_bloginfo(’template_directory’) . ‘/images/name-your-gravatar-image.jpg’;
$avatar_defaults[$myavatar] = “administrator”;
return $avatar_defaults;
}
The add_filter function says that we’ll be editing the avatar_defaults array using our custom function “newgravatar”
The newgravatar function details the location and title of our additional gravatar option
$myavatar = get_bloginfo(’template_directory’) . ‘/images/name-your-gravatar-image.jpg’; points to the new gravatar in the images folder of the template directory
The line after that designates the name that will be displayed next to the image dashboard options. I just happened to name mine administrator, you can name it whatever you want
The third line sends back the results to the avatar_defaults array to be included in the theme











If you would like to leave a comment and you have examples of code you want to show, you must "escape the code". This allows the entire code to show correctly by inserting certain variable around certain tags to make them show. If you don't "escape the code" your code will show up broken, mangled, and it won't be able to be seen correctly. "Escaping the code" is very simple...
Go ahead, leave a comment...