Post Pic

How to: Add author’s gravatar in posts

What about displaying the author picture in your posts? Sure, you can use a well known hack to display a picture located in your theme directory, but what about using Gravatar? In this recipe, I’ll show you how you can easily get the post author gravatar and display it.

To achieve this recipe, simply paste the following code on your single.php file, where you want the gravatar to be displayed:

<?php
	$author_email = get_the_author_email();
	echo get_avatar($author_email, '96');
?>

That's easy as that!

Credits goes to WpEngineer for this very nice tip!

Leave a Comment

* Name, Email, Comment are Required