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.
That’s pretty cool Ian. I enjoying reading your WordPress tips and your new Amazon bookstore looks cool. I gotta find some time to read your creative thinking recommendations.
Pingback: How To: Adding the Post Authors Gravatar To Their Individual Posts
Thanks, Jason. That reminds me: I forgot Thomas Kuhn.
Cool! I love the idea. I’ve seen some sites with the author’s avatar right after the post but isn’t this gravatar thing more applicable in a multi-user blog?
Totally. I wouldn’t recommend using it unless you’re on a multi-user blog.
might have to use this then as it would be handy especially for my website.
Thanks
Pingback: Ultime dal fronte WordPress 18-2008
Pingback: WordPress Weekly News, 18-2008
Pingback: FearlessFlyer.com » SimpleSkin Wordpress Theme
You’re totally talking about my latest theme. I implemented this technique in WPFreemium but instead of using the author’s email, I used their ID e.g. “the_author_ID();”.
It took me hours trying to find out how this worked at first since I couldn’t find any documentation in the codex I had to dig into the core files.
The theme you’ve come up with is a great example what I’ve outlined, Ptah. Very cool.
And it’s totally frustrating when you know, in theory, you can do something and quickly realize you’re going to have to figure out how to do it yourself. Except of course when you figure it out. Then, well, that’s awesome.
hai ian, can you point which specific place to put the code, because i have not found where the loop is? in comment.php, single.php or where?
That would be The Loop.
Pingback: élet és könyvtár » Blog Archive » Szerzői avatarok a címek mellett
Pingback: How To: Adding the Post Authors Gravatar To Their Individual Posts | [Blog Tutorials]
Pingback: 40+ Most Wanted Wordpress Tricks and Hacks
Pingback: 40+ Most Wanted Wordpress Tricks and Hacks | 胡作非为 - 每天精彩文章推荐 - Best Articles of the Day
Pingback: 30个优秀Wordpress技巧
Pingback: 30个优秀Wordpress技巧 | Yansen's Blog
Pingback: 30个优秀Wordpress技巧 | 半瓶可乐
Pingback: 激战的人生 » Blog Archive » 30个优秀Wordpress技巧
Pingback: WP.ORG.CN | 30个优秀的Wordpress技巧为您打造强大的博客
Pingback: 我要当站长–51dzz.com » 30个优秀Wordpress技巧
Pingback: 米老虎的BLOG » Blog Archive » 40+最有用的WordPress技巧
Pingback: 用友资讯 » Blog Archive » 30个优秀Wordpress技巧
I still don’t understand exactly where i’m supposed to place the code. Where should i put it if i want it to look like in the picture? could you please show me?
Where you put the code, Thomas, depends on the theme you’re using (remembering it has to be in The Loop) and how you style it, or position it, using CSS. Give it a try. It’s kinda fun.
Ok thanks for the quick reply
I really don’t know much CSS, but i just discovered that the theme i use, apparently has a single php file for most of the loop stuff… Im going to try to mess around with that, ive managed to do a lot by trial and error before…
By the way do you have any idea how i can find the part of the code that shapes the post headline area? like specific terms to search for or something. I also need to change the color of the headlines themselves, but thats probaly somewhere else…
Pingback: PP BLOG# » Blog Archive » 30个优秀Wordpress技巧
Pingback: 9月森林 » 40+ Most Wanted Wordpress Tricks and Hacks
Pingback: Más de 40 consejos y trucos para Wordpress
Pingback: 30个优秀Wordpress技巧 - 网络应用与资讯
Pingback: 40 consejos y trucos Wordpress para dar a tus proyectos aspectos realmente diferentes. « Xyberneticos
Pingback: 40 consejos y trucos para Wordpress | aNieto2K
Pingback: 40 самых востребованных настроек/доделок/хаков для WordPress
Pingback: 40 Consejos y trucos para WordPress
Pingback: 40 trucos muy buenos para wordpress | Wotevar
Pingback: Mas de 40 trucos y hackeos para Wordpress | Pboza
Pingback: 40+ Most Wanted WordPress Tricks and Hacks | Blogging Tips
Pingback: 40 Consejos para optimizar tu Wordpress » Comenta o Muere | Actualidad, Humor, Tecnología, Política, Ciencia, Música… y otros muchos temas de los que merece la pena hablar.
Pingback: Dicas para você melhorar seu Blog - WordPress | DanielCamargo
Pingback: Cosas por hacer luego de instalar Wordpress | Durmiendo Afuera
Hey, how u did put the align=”right” only to the gravatar image?
can u put me the code u did use to get that exact style?
Pingback: vsFish » 30个优秀Wordpress技巧
Pingback: 41 trucos y consejos para Wordpress « Helektron.com
Pingback: Antibioticos « SoLo Se Que No Se NaDa
Koooooool… Preety simple. I will try the same. Thx.
Pingback: 鱼鱼小札 » Blog Archive » 30个优秀Wordpress技巧
Pingback: 30个优秀的WordPress技巧 | 智康博客--个人日记|网络技术|免费分享|技术交流|WordPress学习
Pingback: 30个优秀的Wordpress技巧为您打造强大的博客 | abe design studio
Pingback: 你不能不知道的30个优秀Wordpress技巧 | Idiigo.com
Pingback: Trucos y consejos para Wordpress | Seosistems
Pingback: 谷歌客 » 30个优秀Wordpress技巧
Pingback: Los 40 trucos mas importantes de Wordpress « Camyna.com
Pingback: Más de 40 consejos y trucos para Wordpress « El Cubanito Web
Pingback: WordPress 常用技巧40+则,诚邀您的参与翻译 - WordPress中文站
Pingback: Nightless Castle:::奈特丽斯城堡 » Blog Archive » 怎样为Wordpress的文章作者添加Gravatars头像
Pingback: T.E.M.P » 30个优秀Wordpress技巧
Pingback: Wordpress Hacks, Guides and Tricks | TechnoBuzz.net
Pingback: Purple Swirl - Free WordPress Theme | Theme Lab
Pingback: WordPress 테마 제작에 필요한 snippet
Pingback: 30个Wordpress技巧 | 灵度°CLEVER8
Pingback: 40 лучших хаков для Wordpress | Listeria.ru
Pingback: 블로그코디 » Blog Archive » Excellent WordPress Theme Resources
Pingback: RCDM » Blog Archive » 40 consejos y trucos para Wordpress (muy interesante)
Pingback: Redbots » 30个有用的Wordpress技巧
Pingback: WordPress 常用技巧40+则 : 从1981年2月开始的人生
Pingback: 40 наиболее востребованных WordPress хитростей. | Гикерские штучки
Pingback: Top 30 Most Wanted Wordpress Tricks and Hacks | Make Money Blogging Experiment
Pingback: WordPress 常用技巧40+则 - 从1981年2月开始的人生
Pingback: 40 consejos y trucos para Wordpress | ProyectoAurora.com
thank you so much for this. I really was looking for that!
Pingback: 30个优秀Wordpress技巧
That’s awesome! I’ve always wanted to add my Gravatar next to my posts. This just topped it all up. Thanks!
Thanks for the info
Pingback: Memasang Gravatar di Judul Artikel « Belajar Wordpress
Pingback: Memasang Gravatar di Wordpress « namaguebima
Thanks for the great help
That really interesting. With a simple 1 line script you can get amazing result. Love it.
Good article, thanks.
For some reason this code works on some of the websites I have worked on, but does not work on others. What cane be the reason?
Here is an example. This author.php page does not show the author’s gravatar:
http://thepublicsphere.com/author/sourena/
The same code in an almost identical page shows the same user’s gravatar:
http://alefba.us/author/hadi/
Pingback: Yazarın Gravatar’ını Gösterelim · Yakup Gövler'in Not Defteri
Pingback: [HOWTOra.ru] » How To Add Gravatars For The Post Author in WordPress
Pingback: Face The World » 40多个你最想要的Wordpress技巧和插件工具
Pingback: 40+ Most Wanted Wordpress Tricks - o2webdev
Pingback: 40+提高WordPress博客应用体验的技巧/插件 - 菠菜博
Pingback: Wordpress Tricks and hacks of my choice | r_shahin : i am web designing
Pingback: wordpress實用技巧40招 | 時間不等於金錢
Thank you so much Ian Stewart, it’s a pretty useful this information.
Pingback: BLOG { jörg steinhauer } » Gods of GFX #2
Pingback: How To Add Gravatars For The Post Author in WordPress
Thanks for the help. I’m new at learning to use Gravatars and I appreciate your insight
Pingback: Wordpress Tips and Tricks | Theme Heven
Pingback: 我想网 » Blog Archive » 40+最值得应用的WordPress技巧和工具
Pingback: Wordpress Tricks and Hacks « Online Free Applications Software Tips Tools Wallpapers
Pingback: 250 Wordpress Tutorials
Pingback: 250 Wordpress Tutorials
Pingback: 250 Wordpress Tutorials
Pingback: Daily Digest for May 22nd | Digital Gilbert
Pingback: KennethBloggen » Blogg arkiv » Mina WordPress listor: Tips & Tricks samt hacks