Rants, Raves, and Rhetoric v4

Gravatars in Blue Zinfindel Theme

For a while I have meant to do this. Here I am with insomnia, so here goes… I have implemented Gravatars for the this Blue Zinfindel theme.

Here is coding I used to implement it to this theme’s comments.php (WP Design > Theme Editor > Comments). Normal text is for context. Bold is what I added.

<li class=”<?php echo $oddcomment; ?>” id=”comment-<?php comment_ID() ?>”>
<?php echo get_avatar(get_comment_author_email(), ’32’); ?>
<?php comment_author_link() ?>

The first place I saw to provide a function rather than a variable is the weblog tools collection post on gravatars. The above is their recommendation with size 32 image. I picked this size because it is the size of the icon inside the WP admin (tested 64, 48, and 30 with 30 seeming about right).

Once I decided to do it, it took me about an hour to find an example using get_comment_author_email() instead of $comments or $id_or_email. It’s easy to implement.


Posted

in

by

Comments

One response to “Gravatars in Blue Zinfindel Theme”

  1. Emma Kane Avatar

    Brilliant – thanks for the code example!

Leave a Reply