Now that Gravatar support is part of the WordPress core adding them into your WordPress theme is easy. Adding them to your comments has been documented. How about adding them to your post titles to highlight the comment author? Within the loop? That’s fairly easy too. Here’s the code:
Pretty simple, huh?
get_the_author_email outputs the post author’s email and the “80” is the size of the avatar image in pixels (you can change that). How this will look depends on how you use it; where you put it in the theme (it has to be in the loop!) and how you style it.
Want an example? I had to figure this out for an upcoming project so…
Look at that frighteningly intense young man there in black and white. Good grief, it’s me! The author of the post! The code, it works! It works!
Ahem. Excuse me. I get a little excited about these things. Good luck using it in your own theme!
949 total views, 1 views today