How to Display Author’s Gravatar on their Posts in WordPress
In many WordPress multi-author blogs, you may see a gravatar image of the author near the title of the post. It helps readers easily distinguish the author of the post. Although Quick Web Resources is a single author blog, I also used to show the author image even in post loops. By default, most of the themes show author bio below the post content but not in the post loops and home page.
Most of the themes and frameworks now support this and show author gravatar image icon near the title of the post. But what if your theme does not support this feature? I saw many blogger searching for the plugins to add this kind of author photo feature. But, you do not need to worry about this. You can do this without using any kind of plugin.
Just put this code where you want to show the author gravatar photo.
<?php echo get_avatar( get_the_author_email(), '48' ); ?>
This code is simple to understand. get_the_author_email() function fetches the email of the author and get_avatar() function puts the gravatar image of the author. Number 48 is the size of the image in pixels. You can change it according to the space available in your design format.
Be sure to create a gravatar account and then upload your picture before using this. Gravatar is known as the globally recognized avatar. Not just WordPress but many services use this. If you have not added a photo to gravatar, it will show default gravatar photo in place of your photo. So create an account there and upload a photo of you. Not just on your website, but this gravatar image will also be shown in blogs where you comment or write guest articles.
Also read: WordPress.com Vs WordPress.org
Now you know how to put gravatar image in post loops. try this code for this. If you do not have knowledge of coding, you can always hire me to work for you. I can help you with little cost or for free.
If you have anything to ask, you can comment below.