Php Flow » Wordpress

WordPress:Display Avatar for Currently Logged-In User

The wordpress is very excellent CMS for end user as well as development end. The wordpress has very rich set of function to get your aim,Ex. we want to display the currently logged in users avatar. In wordpress we can do very easily, with help of below code we can display the currently logged in users avatar in our theme.

1
2
3
4
5
<?php
        global $current_user;
        get_currentuserinfo();
        echo get_avatar( $current_user->ID, 64 );
 ?>

We can modify the width of Avatar image.The second argument of get_avatar() function is the size parameters of avatar.The default is 96px and max is 512px.

Did you enjoy this article? Share it!

About the Author:

Hi, This is Parvez Alam from India. I am software developer with 4 years’ experience in web development. I have submitted articles on PHP, Mysql, Magento,CSS, HTML, jQuery, web designing and social API. You can subscribe to my blog via RSS/Twitter/Google plus and Facebook. parvez1487(at)gmail(dot)com

Random Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>