Wordpress: Display Author Info Snippet Wordpress: Display Author Info Snippet

WordPress: Display Author Info

This code is very useful if you have a WordPress website with multiple authors. The code will display a section with your gravatar, name and a little bio (the one you fill out in your user profile). This way, when people read an article written by you, they can see your info.

If you want this to appear on posts, you can add this snippet to single.php:

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

Feel free to style the classes (author-box, author-pic, author-name and author-bio) as you see fit on your CSS. The ‘100’ you see on the get_avatar function is the width and height of the gravatar. If it’s 100, then it would be 100×100, you can change it to any number.

If you have any questions, please let me know!

  1. Thank you! I am a complete novice when it comes to code-writing so I’ll take all the help I can get. This will be really useful if I ever have guest posts.

    1. It depends on the styling you give it using CSS, but you should see the avatar to the left, then the name and the bio description the user filled out on their profile. You add the snippet wherever you want it to show up. I suggest you add it after the post body content but before the user comments. I will edit the tutorial as soon as possible and add a preview of how it looks. Have a great day Aida!

Leave a Reply

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