How To Start An Internet Business From Anywhere. Even Malaysia!


Posts Tagged ‘gravatar’

How To Add A Gravatar Image To Your Comments/ Blog

Tuesday, February 17th, 2009

Adding your picture to your comments with the Gravatar service is a great was to feel more ‘connected’ with your readers, or as a reader yourself.

gravatars1When you leave a comment, do you look like one of these icons? Do you wonder how come the other people have a little screen shot of their face, logo or some other cute picture next to their name? While you are a blank silhouette of a man or a spectacled smiley face?

Well that’s because they’ve set up a Gravatar account which is linked to their email address. Whenever you leave a comment (with a Gravatr linked e-mail address) then your selected picture will appear in the box next to the comments section.

gravatars2

To setup a Gravatar account follow these steps:

1) Go to http://gravatar.com
2) Sign up for an account

gravatars3

3)Login to your new account

gravatars4

4) Click ‘Add an Email Address’

5) Type in your e-mail address that you use to leave comments (or the admin e-mail address you use for your blog) and click ‘add’

gravatars5

6) Click ‘add a new image’

gravatars6

7) Upload a picture from your hard disk, a website or straight from your webcam.

gravatars7

8) Choose an image for your email address

9) Select the image that you just uploaded

10) Click ‘confirm’ when it asks you to

It’s as simple as that! Leave a comment with your new Gravatar picture below to test it out.

But what if you don’t have the little box next to your comments on your blog? How do you install it?

This only works if you have a Wordpress blog.

1) You need to have access to the files on your server. For that, I’ll leave it up to you to figure out how to get them. I use Dreamweaver to get to my files.

2) Find http://yourdomain.com/wp-content/themes/yourtheme/comments.php (where yourdomain.com represents where you installed your blog and yourtheme is the theme you are using for your Wordpress blog)

3) Open comments.php in Dreamweaver or notepad if you don’t have it.

4) Find this line:

<?php foreach ($comments as $comment) : ?>

Anything under this line is for the comments section of your blog.

5) If you want to put your Gravatar icon above your name in the comment box (like my comment box below) then search for this line.

<cite class=”comment-author”><?php comment_author_link() ?></cite>

and ABOVE it paste this line:

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

where the number represents how big you want the Gravatar image to be. Default is 32 (i.e. 32×32 pixels big) but I put mine a little bit bigger.

6) Save your file and upload it back to your server.

7) Refresh your page and the box for Gravatar images should be there.

Please remember that not all themes are the same and this method may or may not work for you. But it should work for the default and more popular themes out there.

Share this article if you liked it!

Thanks,

-William Lee