WordPress show author avatar

If you want to show the avatar of a WordPress author you can do this by:

First, get the author e-mail and put it in a variable:

<?php $user_email = get_the_author_meta('user_email'); ?>

And then, put this variable in the id_or_email parameter of the get_avatar(); function to distinguish which author you need, and echo the function out:

<?php echo get_avatar( $user_email, 80, $default, $alt ); ?>

More information about the get_avatar(); function: http://codex.wordpress.org/Function_Reference/get_avatar

Tip: I use the Worpress User Avatar plugin to upload a avatar picture to the author.


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 )

Google+ photo

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

Twitter picture

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

Facebook photo

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


Connecting to %s