Home WordPress How to show Gravatar for Authors on their Individual WordPress Posts?

How to show Gravatar for Authors on their Individual WordPress Posts?

by Satish Kumar

Nowadays there are lots of community blogs over the network, they work like a community so there are more than one authors on these blogs.  Sometimes all authors are using the same credential for the blog so readers are facing difficulty in distinguishing the author’s articles. So, in this article, I’ll show you how you can use author’s gravatar image for individual author’s posts.

To use the Gravatar, authors should have a profile on “gravatar.com” and one email address which is register on gravatar. So first, Authors need to create a gravatar profile account and register one email address on gravatar.

After creation of gravatar account, you need to use the same email address in WordPress author’s profile and locate the file “index.php” and “single.php” in WordPress source code and add below code where you want to show the gravatar image.

Gravatar Code:-

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

The above code will track the email from WordPress author profile and try to fetch the gravatar account which is registered with the same email address and the 52 value is representing the size of the pixel which you need to change according to your theme requirement or design.

Don’t forget to subscribe to GUTANN email newsletter to keep updating yourself with such posts in future.

Dear learners, if you need any help for your blog you can get the suggestion by commenting below or contact me by using the contact form.


You may also like

Leave a Comment

16 − 6 =