Display Author Info

The image that shows for the author comes from the email address set for that user which goes to a corresponding Gravatar. The display name and bio come from the User settings area in the Admin.

<div class="author-box">
   <div class="author-pic"><?php echo get_avatar( get_the_author_email(), '80' ); ?></div>
   <div class="author-name"><?php the_author_meta( "display_name" ); ?></div>
   <div class="author-bio"><?php the_author_meta( "user_description" ); ?></div>
</div>

That should be all the CSS hooks you need to style up the area however you want. Note: some of these functions are WordPress 2.8 and newer only.

Comments

  1. User Avatar
    Ahmad Awais
    Permalink to comment#

    Some nice css to this code by your professional hands will be appreciated

  2. User Avatar
    Andrai
    Permalink to comment#

    The author Meta shows as unstyled text, IE not wrapped in any tags. Makes it hard to style. How to run the author meta query but return a p tag?

    • User Avatar
      Stephan
      Permalink to comment#

      I prefer to put $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author)); right at the top, outside the loop, to hold the author info.
      Then use like echo $curauth->description; etc. to display the info.

      @Andrai If you use the method above, you can use <div class="author-bio"><?php echo nl2br($curauth->description);?></div>

      Just edit the bio on your profile, and add line breaks where ever you want, the above code will force it to display.

Posting Code

You may write comments in Markdown. This makes code easy to post, as you can write inline code like `<div>this</div>` or multiline blocks of code in triple backtick fences (```) with double new lines before and after.

Code of Conduct

Absolutely anyone is welcome to submit a comment here. But not all comments will be posted. Think of it like writing a letter to the editor. All submitted comments will be read, but not all published. Published comments will be on-topic, helpful, and further the discussion or debate.

Want to tell us something privately?

Feel free to use our contact form. That's a great place to let us know about typos or anything off-topic.

Submit a Comment

icon-closeicon-emailicon-linkicon-menuicon-searchicon-tag