Posted on : 02-04-2009 | By : Japh
If you’ve been using WordPress for a little while, and don’t really much like the default options you have to choose from when a commenter doesn’t have their own Gravatar, why not make your own?
Make yourself a little square image to use that matches in with your theme, and then insert the following line of code:
<?php echo get_avatar( $comment, 86, 'http://example.com/custom-default-av.png' ); ?> |
Note: you must provide the full absolute URL for your image.
What this line does, is show a Gravatar for the user if they have one, and if not, show your custom one instead. The number “86″ is the pixel width and height you want the Gravatars to display at.
Remember that this will only work in WordPress 2.7+, or possibly in older versions if you have the Gravatar plugin installed (not tested).
Update: If you don’t know what a Gravatar is, check out the comments. The avatar’s shown beside each comment are automatically pulled in from Gravatar’s service, so you upload your avatar once, and it appears everywhere when you comment etc. Get yourself one here: Gravatar
Related posts:
- WP-IE6Update plugin for WordPress Everyone wishes they could get rid of IE6, and now...





Works perfectly! I’m using this on my blog
What? I’ve never even heard of a gravatar. I can’t believe I call myself a geek… i think I may have no idea
Haha! Well I’ve updated the post, in case there’s another person out there who’s not heard of Gravatars.
Basically, it’s the reason John has a nice little picture beside his comment, and you have an little white/gray silhouette (I really need to use the method from this post on my own blog!)
Looks like I get it now
Thanks Japh i now have a face to blog with.
Thanks for sharing. I’ll should be adding that to my blog soon.
avatars set …
thanks …
i reached your blog using google search … google highlights the words i searched for in your article … and there are just too many color highlights … its weird … just wanted to let you know this …
Hi Subcorpus,
I’m not sure what you mean about too many colour highlights, sorry. Do you have a screenshot or something? I guess if you use a lot of search terms, and I used them multiple times in my post it might look like that.
Best of luck with your blog too, by the way, I read a few posts and it’s quite fun
this is what i been looking in the past few weeks now thanks alol make my day