Adding avatars on a Digg 3-column theme for WordPress
One of the problems moving out of WordPress.com is that the theme that you’re accustomed too somehow won’t work as expected. The Digg 3-column theme is an old theme so not all the features of the latest WordPress release works on it.
One of which is the support for Avatars/Gravatars. WordPress 2.5 and up incorporates avatars on comments without the need of plugins (Settings > Discussion).
But with the Digg 3-column theme, you need to tweak the code a little. Don’t worry, it’s not that hard.
1. First go to your themes folder for Digg and open comments.php for editing.
2. Then look for this piece of code:
<!– You can start editing here. –>
<?php if ($comments) : ?>
<h3 id=”comments”><?php comments_number(‘No Responses’, ‘One Response’, ‘% Responses’ );?> to “<?php the_title(); ?>”</h3><ol class=”commentlist”>
<?php foreach ($comments as $comment) : ?><li class=”<?php echo $oddcomment; ?>” id=”comment-<?php comment_ID() ?>”>
<div class=”commentmetadata”>
3. Add the following code directly under it.
<?php if(function_exists(‘get_avatar’)) { echo get_avatar($comment, ’35′); } ?>
The number on the right is the size of your avatar. In this case, it’s 35 x 35. Feel free to change it. This is the code that needs to be placed on all old themes to support avatars.
4. Save it afterwards then open style.css
5. Insert this piece of code to style your avatar somewhere,
.post img.avatar {float:right; margin-left:5px; padding:0px;}
This code positions the avatar on the right of the comments just like what it does on WordPress.com.
6. Save your file and view your work.
That should do it. Let me know if you’re having any problems.
You might also be interested in:
- Removing the Meta widget from WordPress blogs
- Blogger or WordPress? Which one’s for you?
- Adding a Favicon to your site
- Image Caption not appearing in WordPress?
Filed under: Blogging Experience



Calvin:
I tried this and it didn’t work
hi SBM, you also need to enable your avatars. you can do it in Settings > Discussions > at the bottom is the Avatar section.
Thanks Calvin. I’ll try it
hi let me know if that did the trick for you. thanks!
I tried it but couldn’t get it to work. I’m running the latest ver. of wordpress and my settings to display avatars is turned on. Any help would be greatly appreciated.
PS have you figured out how to display avatars on recent comments section?
Hi L, for WP 2.7, you don’t have to edit the comments.php. Overwrite the comments.php of your digg theme from the default one included in WP 2.7.
I dont know how to display the avatars on the recent comments widget. The width of the sidebar is too narrow so avatars will just take up space so I didn’t put it in.