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 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…

Author Gravatar Example

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 thoughts on “How To Add Gravatars For The Post Author in WordPress

  1. Pingback: 你不能不知道的30个优秀Wordpress技巧 | Idiigo.com

  2. Pingback: Trucos y consejos para Wordpress | Seosistems

  3. Pingback: 谷歌客 » 30个优秀Wordpress技巧

  4. Pingback: Los 40 trucos mas importantes de Wordpress « Camyna.com

  5. Pingback: Más de 40 consejos y trucos para Wordpress « El Cubanito Web

  6. Pingback: WordPress 常用技巧40+则,诚邀您的参与翻译 - WordPress中文站

  7. Pingback: Nightless Castle:::奈特丽斯城堡 » Blog Archive » 怎样为Wordpress的文章作者添加Gravatars头像

  8. Pingback: T.E.M.P » 30个优秀Wordpress技巧

  9. Pingback: Wordpress Hacks, Guides and Tricks | TechnoBuzz.net

  10. Pingback: Purple Swirl - Free WordPress Theme | Theme Lab

  11. Pingback: WordPress 테마 제작에 필요한 snippet

  12. Pingback: 30个Wordpress技巧 | 灵度°CLEVER8

  13. Pingback: 40 лучших хаков для Wordpress | Listeria.ru

  14. Pingback: 블로그코디 » Blog Archive » Excellent WordPress Theme Resources

  15. Pingback: RCDM » Blog Archive » 40 consejos y trucos para Wordpress (muy interesante)

  16. Pingback: Redbots » 30个有用的Wordpress技巧

  17. Pingback: WordPress 常用技巧40+则 : 从1981年2月开始的人生

  18. Pingback: 40 наиболее востребованных WordPress хитростей. | Гикерские штучки

  19. Pingback: Top 30 Most Wanted Wordpress Tricks and Hacks | Make Money Blogging Experiment

  20. Pingback: WordPress 常用技巧40+则 - 从1981年2月开始的人生

  21. Pingback: 40 consejos y trucos para Wordpress | ProyectoAurora.com

  22. Pingback: 30个优秀Wordpress技巧

  23. Pingback: Memasang Gravatar di Judul Artikel « Belajar Wordpress

  24. Pingback: Memasang Gravatar di Wordpress « namaguebima

  25. Pingback: Yazarın Gravatar’ını Gösterelim · Yakup Gövler'in Not Defteri

  26. Pingback: [HOWTOra.ru] » How To Add Gravatars For The Post Author in WordPress

  27. Pingback: Face The World » 40多个你最想要的Wordpress技巧和插件工具

  28. Pingback: 40+ Most Wanted Wordpress Tricks - o2webdev

  29. Pingback: 40+提高WordPress博客应用体验的技巧/插件 - 菠菜博

  30. Pingback: Wordpress Tricks and hacks of my choice | r_shahin : i am web designing

  31. Pingback: wordpress實用技巧40招 | 時間不等於金錢

  32. Pingback: BLOG { jörg steinhauer } » Gods of GFX #2

  33. Pingback: How To Add Gravatars For The Post Author in WordPress

  34. Pingback: Wordpress Tips and Tricks | Theme Heven

  35. Pingback: 我想网 » Blog Archive » 40+最值得应用的WordPress技巧和工具

  36. Pingback: Wordpress Tricks and Hacks « Online Free Applications Software Tips Tools Wallpapers

  37. Pingback: 250 Wordpress Tutorials

  38. Pingback: 250 Wordpress Tutorials

  39. Pingback: 250 Wordpress Tutorials

  40. Pingback: Daily Digest for May 22nd | Digital Gilbert

  41. Pingback: KennethBloggen » Blogg arkiv » Mina WordPress listor: Tips & Tricks samt hacks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s