Posted By

vagrantradio on 02/16/10


Tagged

wordpress custom avatar gravtar


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

themolitor
reideiredale


WORDPRESS CUSTOM DEFAULT GRAVATAR


 / Published in: PHP
 

Gives you the option to select a custom gravatar in the Wordpress discussion setting in admin dashboard

  1. //place this in your functions.php file
  2. <?php
  3. add_filter('avatar_defaults', 'newgravatar'); function newgravatar ($avatar_defaults) {$myavatar = get_bloginfo('template_directory') . '/images/default_gravatar.png'; $avatar_defaults[$myavatar] = "yournamehere"; return $avatar_defaults;}
  4. ?>
  5.  
  6. //add this where you want your gravatar, notice the default url "<pathtourl>" removed
  7. <?php echo get_avatar($comment,$size='48',$default='' ); ?></div>

Report this snippet  

You need to login to post a comment.