Viewing 5 replies - 1 through 5 (of 5 total)
  • nickaster,

    I can’t recall where I picked this code up and if the author sees this I apologize.

    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.

    // 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' );
    } ?>
    Thread Starter nickaster

    (@nickaster)

    Outstanding. Works like a charm!

    Thread Starter nickaster

    (@nickaster)

    So – dig this beat:

    Do you know nay magic code to make it so the default for a commenter is different from the default for an Author? I’d like the Authors to look one way by default, and the commenters to be something else!

    That’s a really neat slot – thanks!

    FANTASTIC! thanks so much for this tidbit.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom Default Avatar’ is closed to new replies.