Identify Authors With Gravatars


Since WordPress version 2.5, it is easier to include the Gravatar of a comment author in the comments. WordPress offers a feature that is easy to use and it brings some parameters with. In order to use and how to include a Gravatar, I would refer to the article „Gravatar Use Easy“.

But with this feature you can do more. Magazine-style for blogs are currently in high demand and many blogs have a a couple of authors. Many times the blogs link and present the author of the respective contribution. WP offers a whole range of template tags to this functionality, check out Codex.

Now it would be nice to give the author a face. You can do that with the Plugin „Extended User Profile“ and enter more information in the backend of WordPress.

Alternatively you can load the Gravatar of the author. The Gravatar function get_avatar() works great in the loop of WP and you just have to assign the email address. It’s easily done by the template tag get_the_author_email().


This above code creates this:

	

Alternatively you can get the email directly, with any variables.


Use CSS to format, you can use the class avatar, which is also assigned to the comments. Simultaneously there is also a class, which is created in regard to the Gravatar size, for the above syntax it would be avatar-80. So it’s possible to format the picture of the author with this class.


Posted

in

by

Comments

12 responses to “Identify Authors With Gravatars”

  1. […] goes to WpEngineer for this very nice tip! Did this tip help you? If so, feel free to make a small […]

  2. Lilly Avatar

    Hi, just a quickie to say thanks for this post. Instead of pumping out yet another silly wordpress plugin does something really simple, your posted this wonderfully straight forward post that answered all my questions quickly and sweetly. So, thanks 🙂

  3. Alex Avatar

    Our pleasure Lilly 🙂

  4. […] 20. 用Gravatars头像来区别作者 […]

  5. ragi Avatar

    Thanks!!!!! 🙂

  6. […] 20. 用Gravatars头像来区别作者 […]

  7. azril Avatar

    Nice info. Trying to get gravatar in my comments page

  8. ebusinessmom Avatar

    Thanks for this post. I’ve been updating gravatar options on my blog with not much to go on. I’m learning every single day how to make every aspect of my blog much better for my readers, and ugly default gravatars was one of my problems. Thanks again for the tips that I’m working on implementing.

  9. Jacob Avatar

    Ahh! This is great, I was searching for a good 30 minutes before I stumbled across this page. I’d already tried a few plugins but they were all too bulky, this is perfect!

  10. M. Lucarelli Avatar
    M. Lucarelli

    I thank you very much for that! Congratulations!!!
    Simple and perfect!
    Best regards!

  11. LB Avatar
    LB

    Alex, any way you know of to get that same thing on the main homepage with each excerpt? i know this might vary based on theme, but anything might help. Thanks.