Shortcode to display user avatar anywhere in WordPress.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

User Avatar WordPress

This small shortcode lets you display the user avatar anywhere on a site built on WordPress. The shortcode takes care of logged in user and normal users. Logged in users will be shown their avatars. Logged out or nornmal users will be shown the default WordPress avatar which can be changed from Settings > Discussion.


You can include the .php file in your theme's functions.php file or copy and paste the code into the functions.php file itself.

Use this shortcode by using [display-user-avatar] or <?php echo do_shortcode('[display-user-avatar]')?> if you are using the shortcode outside the editor in a php file.

You can also adjust the size of the avatar by changing the integer parameters in the get_avatar() function.

Follow me on twitter, LinkedIn, Google+ or Facebook or visit my site and blog.

Copyright © 2013 Riyadh Al Nur. All rights reserved.