Comments on online blogs and websites are one of the main ways of helping build a community.  WordPress enables commenters’ email addresses to be matched against the database on the Gravatar website to see if the user has uploaded an avatar for their email address.

Generally this works well for tech or computing websites where the readers will be generally more familiar with Gravatar, but for those of you who blog to an audience on non-technology matters it is likely that a vast majority of your users will not be familiar with, or even want to sign up to, the Gravatar site.

So what happens?  WordPress uses the default gravatar icon next to their comments.

default-gravatar

Boring!

But you can easily change the default avatar/gravatar icon for your wordpress blog by following the simple steps below.

1. Using a graphics program create an image 96 x 96 wide – or whatever size square you intend to use on your site. Make sure you choose a background colour that will help it stand out on your comments page – for blogs on white backgrounds you can see the default gravatar uses a grey background.

(I’m no graphic wizard but I quickly knocked up this new logo for the purpose of this tutorial)

jd77logo

2. Locate your avatar code

Usually found in your comments.php file for whichever theme you are using on wordpress you will see a line similar to something like this:

<?php echo get_avatar( $comment, 80 ); ?>

or

<?php echo get_avatar( get_comment_author_email(), '80' )?>

The 80 here represents the default size and can be customised to whatever size you want. All you need to do is add an extra comma after this number and insert the url to your default icon.

eg.

<?php echo get_avatar( $comment, '80' , 'http://www.jd77.co.uk/files/jd77logo.jpg' ); ?>

Save and upload your file again and you have changed your default wordpress avatar.

Tags: , ,