Before Wordpress 2.7 I achieved a custom gravatar image on kremalicious.com with this code placed in the comments.php template file:
So we were able to set a path to our image we wanted to use as the default gravatar image. But with Wordpress 2.7 we have the new function
<?php wp_list_comments(); ?> which pretty much simplifies writing comment template code. Although it has a parameter for the avatar size it doesn’t have one for setting a custom image like before.
But we can use the functions.php file in your template directory and add some lines to it: (If you don’t have a functions.php file just create one.)
Just set a name for your custom Gravatar image to show up beside the image in the Wordpress back-end. The code above assumes you have your custom default gravatar image inside a folder called images inside your template directory. Change it to your environment if neccessary. After that a new entry in the Wordpress backend under Settings > Discussions will appear with the custom image specified:
And you can adjust the displayed size of the gravatar image by adding a parameter to
<?php wp_list_comments(); ?> function in your comments.php file:
And that’s it. As you would guess I pretty much prefer this way to adjust the gravatar image. But you’re free to write your custom comment callback function to exactly define the output of the comments. But it’s definitely too much if you just want to change the gravatar stuff.