RSS Comments

RSS Entries

Total Themes

Adding Gravatars to Older Themes

Added by :blogger

Date :July 20 2008

Subscribe : TotalThemes RSS

Rate this
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Wordpress 2.5 and above has automatic support for avatars/gravatars but only if the theme designer has integrated the code into the comments.php

If your blog is running an older theme and you would like to add gravatars to comments it really could not be easier. 

All you have to do is add a single line of code to your comments.php

<?php if(function_exists(’get_avatar’)){ echo get_avatar($comment, ‘50’);} ?>

open comments.php in any code editor, you will see a line that says edit below this point. The image below shows the code before the avatar code being added.

We have decided we want the gravatar to be displayed to the right of the comment text below the name. The first thing to do is copy the code (above into the appropriate place). 

If you upload this to your theme folder you will find the gravatar is above the text, to get it to float to the right we now need to add the following code anywhere in your style.css file. 

img.avatar {float:right; margin-left:5px;}

you can obviously opt for floating left or a different border or margin size but this should be enough to enable you to add Gravatars for any theme.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • TwitThis




Leave Comment