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> </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!