Posted By

alp on 06/06/11


Tagged

wordpress admin functionsphp


Versions (?)

Wordpress: Customize Default Gravatars


 / Published in: PHP
 

URL: http://digwp.com/2010/04/wordpress-custom-functions-php-template-part-2/

  1. /**
  2.  * Customize Default Gravatars
  3.  * http://digwp.com/2010/04/wordpress-custom-functions-php-template-part-2/
  4.  *
  5.  **/
  6. function myfunction_custom_gravatars($avatar_defaults) {
  7.  
  8. // change the default gravatar
  9. $customGravatar1 = get_bloginfo('template_directory').'/images/gravatar-01.png';
  10. $avatar_defaults[$customGravatar1] = 'Default';
  11.  
  12. // add a custom user gravatar
  13. $customGravatar2 = get_bloginfo('template_directory').'/images/gravatar-02.png';
  14. $avatar_defaults[$customGravatar2] = 'Custom Gravatar';
  15.  
  16. // add another custom gravatar
  17. $customGravatar3 = get_bloginfo('template_directory').'/images/gravatar-03.png';
  18. $avatar_defaults[$customGravatar3] = 'Custom gravatar';
  19.  
  20. return $avatar_defaults;
  21. }
  22. add_filter('avatar_defaults', 'myfunction_custom_gravatars');

Report this snippet  

You need to login to post a comment.