Posted By

math89 on 07/20/10


Tagged

wordpress avatar


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

laurentzziu


How to Set Your Own Default Gravatar in WordPress


 / Published in: PHP
 

Add the following code to the end of the functions.php file. Et voilà !

  1. function add_custom_gravatar ($avatar) {
  2. $custom_avatar = get_bloginfo('template_directory') . '/images/name-of-your-custom-gravatar.jpg';
  3. $avatar[$custom_avatar] = "Gravatar name to be shown in the WordPress settings"; //change this name to your preferences
  4. return $avatar;
  5. }
  6. add_filter( 'avatar_defaults', 'add_custom_gravatar' );

Report this snippet  

You need to login to post a comment.