How to Display the Author Avatar Photo in a WordPress Template

You would think there is a simpler way to directly call the avatar photo of author for a post in a template, but you can do so with this little trick 🙂

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

You can replace 100 with the size in pixels you want the image to display.  This code will output the entire image tag.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s