Return to Snippet

Revision: 49600
at July 26, 2011 06:18 by xcsteve99


Initial Code
// Add a default avatar to Settings > Discussion
if ( !function_exists('fb_addgravatar') ) {
	function fb_addgravatar( $avatar_defaults ) {
		$myavatar = get_bloginfo('template_directory') . '/images/avatar.jpg';
		$avatar_defaults[$myavatar] = 'Doc4';

		return $avatar_defaults;
	}

	add_filter( 'avatar_defaults', 'fb_addgravatar' );
}

Initial URL
http://wordpress.org/support/topic/custom-default-avatar

Initial Description
Add the following to your active theme's functions.php file then upload an image named "avatar.jpg" to your active theme's image folder. The image can be named anything you would like but be sure to change it in the code below as well.

The last step is to visit: Settings > Discussion to select the new avatar as the default.

Initial Title
Wordpress - Custom Default Avatar

Initial Tags
wordpress

Initial Language
PHP