Posted By

xcsteve99 on 07/26/11


Tagged

hack wordpress wp change avatar


Versions (?)

Wordpress - Custom Default Avatar


 / Published in: PHP
 

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

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.

  1. // Add a default avatar to Settings > Discussion
  2. if ( !function_exists('fb_addgravatar') ) {
  3. function fb_addgravatar( $avatar_defaults ) {
  4. $myavatar = get_bloginfo('template_directory') . '/images/avatar.jpg';
  5. $avatar_defaults[$myavatar] = 'Doc4';
  6.  
  7. return $avatar_defaults;
  8. }
  9.  
  10. add_filter( 'avatar_defaults', 'fb_addgravatar' );
  11. }

Report this snippet  

You need to login to post a comment.