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:
<?php echo get_avatar( get_the_author_email(), '80' ); ?>
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!
By the way, did you know WordPress has built in email protection from spam bots (read Disguising Your Email)? I didn’t. Neat.
162 responses
[…] Add Gravatar for post author […]
[…] Add Gravatar for post author […]
[…] Add Gravatar for post author […]
[…] 2.为评论作者增加Gravatar头像 […]
[…] Add Gravatar for post author […]
[…] Add Gravatar for post author […]
[…] Add Gravatar for post author […]
[…] 2.为评论作者增加Gravatar头像 […]
[…] Add Gravatar for post author […]
[…] How to Add Gravatars for the Post Author in WordPress […]
[…] yazı sahiplerine gravatar eklemek […]
[…] yazı sahiplerine gravatar eklemek […]
this tutorial simple but very useful
thanks
5 stars
[…] Add Gravatar for post author […]
Thank you very much for this useful information.
I created a plugin recently to display “about the author” box above the posts and I used gravatar in it.
Thanks again and take a look at the plugin.
[…] Add Gravatar for post author […]
[…] Add Gravatar For Post Author […]
[…] Add Gravatar for post author […]
ian — but where do I put my email so gravatar can identify the user?
[…] Añade gravatar del autor a los posts […]
Thanks, Jason.
[…] Add Gravatar for post author […]
[…] Add Gravatar for post author […]
[…] How to Add Gravatars for the Post Author in WordPress […]
[…] How to Add Gravatars for the Post Author in WordPress […]
[…] Add Gravatar for post author […]
Hi i just put the code into the single.php archive from my theme. I put it in the code of the title at the beggining of the title and reduced the size from 80 to 50 and now it looks great.
A great simple code!!
Thanks
Very cool! Implemented it in about 2 seconds, using a float right. Thanks!
[…] Add Gravatar for post author How about adding Gravatar to your post titles to highlight the comment author? […]
There’s already quite a few plugins that do the same thing. But this is a nice tip. You’ll get a nice effect very easily. Thanks for sharing!
[…] Add Gravatar for post author […]
[…] 12. Add Gravatar for post author […]
[…] 12. Add Gravatar for post author […]
Hello, just want to know where to put that code ….I do not know what’s loop…
[…] Source… […]
[…] Añade gravatar del autor a los posts […]
thanks… i will apply that.. i’ve been looking for some fine tips and here’s the best one..
[…] themeshaper.com/how-to-add-gravatars-for-the-post-author-in-wordpress/ […]
[…] Add Gravatar for post author […]
[…] Add Gravatar for post author […]
[…] How To Add Gravatars For The Post Author in WordPress Now that Gravatar support is part of the WordPress core adding them into your WordPress theme is […]
[…] 2、显示作者Gravatar头像 […]
[…] Add Gravatar for post author […]
i just know how to put the code, usually i just use a ready themes for gravatar
thanks
Excellent! I wanted the pic in the bottom under the content (which this works great for, by the way), but now I think I might like to have it up there at the top. Thanks for the help.
[…] 12. Add Gravatar for post author […]
[…] 2.为评论作者增加Gravatar头像 […]
[…] 2.为评论作者增加Gravatar头像 […]
Thats a very good collection to bookmark and look at various occasions. Thanks!
Thanks for good information. But can u tell, where this code I must put?
P.S. I’ve click to twitter))