Sometimes we need to show the information of the author of WordPress blog post. Like author name, author photo, author’s favorite links, author’s list of posts, author’s brief information etc.

Install ‘Profile-Pic‘ to upload, store photo in system, and show the profile photo of the wordpress post author. Download Profile-Pic

Here is the code to show the profie photo:

<?php $pic = profilepic_internal_picpath($user_ID, false); ?>
<img src="<?php echo $pic; ?>" width="60" />

the variable $pic takes following path: http://localhost/yoursite/wp-content/profile-pics/1.jpg. Where 1.jpg will be your profile photo.
But to show blog post author’s information and photo we need to do more stuff. Follow the steps given and your are done!

1. Check if the post is exist

<?php if(have_posts()) : ?>

2. Get the post if having

<?php while (have_posts()) : the_post(); ?>

3. Get the post author

<?php $postAuthor = $post->post_author; ?>

4. Get the profile pic of the post author

<?php $pic  = profilepic_internal_picpath($postAuthor, false); ?>

Note: Don’t use the_author_ID() or $user_ID. It doesn’t work! The '$post->post_author' will give you the ID of the post author.

5. Check the categories of current author

<?php $curauth = get_userdata(intval($postAuthor)); $getCat = $curauth->user_login; ?>

6. Get the path/url of current post author’s profile photo

<?php echo $pic; ?>

7. Get the NicName of current post author

<?php echo the_author_nickname(); ?>

8. Get brief information about author

<?php echo the_author_description(); ?>

9. Get the list of links based on current author’s username

<?php wp_list_bookmarks('category_name='.$getCat ); ?>

10. Specify how many posts you want to show

<?php $recentposts = get_posts('showposts=5'); ?>

11. Check those posts are exist and then loop it

  if ($recentposts) {
   foreach($recentposts as $post) {

12. Display the list of posts

<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
<?php the_title(); ?>
<?php the_time('m.d.y'); ?>

Here is the complete code

  if(have_posts()) :
    while (have_posts()) : the_post();
      $postAuthor = $post->post_author;
      $pic        = profilepic_internal_picpath($postAuthor, false);
      $curauth    = get_userdata(intval($postAuthor));
      $getCat     = $curauth->user_login;

      echo '<img src="'. $pic .'" width="60" alt="'. the_author_nickname() .'" />';

      echo the_author_description().'<br/>';
      echo 'My Favorite Links<br/>';

      wp_list_bookmarks('category_name='.$getCat );
      $recentposts = get_posts('showposts=5');

      if ($recentposts) {
        foreach($recentposts as $post) {
          echo '<p><a href="'. the_permalink() .'" title="Permanent link to '. the_title_attribute() .'">'. the_title(); .'</a></p>';