Free Wordpress Blog Setup

How to Display Author’s Gravatar on their Individual Posts in WordPress

By Editorial Staff in Tutorials
How to Display Author’s Gravatar on their Individual Posts in WordPress

There are many blogs now that have more than one author. Sometimes reader can’t distinguish it easily who wrote it because usually the author credentials are small. Therefore in this article we will show you how you can add an author’s gravatar image in their individual posts.

This tutorial is really easy to follow. You don’t need any big plugin. Just a short snippet of code. You would need to create an author’s profile and add the email address which is also registered with gravatar. Once you have done that follow the directions:

First you need to open single.php and/or index.php, and then add the following code where you see fit.

<?php echo get_avatar( get_the_author_email(), '48' ); ?>

Basically this code will take the email you entered in the author’s profile and try to fetch the gravatar associated with that email. The 48 value represents the size in pixels which you can change to match your design formatting.

What Next?

Digg it
Save This Page
Subscribe to WPBeginner
Stumble it
Free Wordpress Blog Setup

Share Your Opinions

Tell us what you're thinking...
and if you want a pic to show with your comment, then get gravatar!

Please make sure that you have read our Comment Policy.

Due to high volume of request from our readers, we are adding this feature that allows you to stay updated with this post's comments without having to participate in the discussion even though we would love your input as always. Don't worry we hate SPAM just as much as you do, so you will never receive any SPAM messages from our site and that's our promise to you.

Subscribe without commenting

Close Bar