Adding An Author Bio
Adding an author bio to your posts and pages is pretty simple. It can be an informative and quick way to introduce your writers. And it assists those visitors that may be blog hopping and just happened upon your site. They can get a quick feel for who you are and they may decide that they really like you.
First, make sure that the WordPress user profile(s) has a description entered. You can write one in your WordPress Dashboard under Users.
We will be using this code that you can pull yourself from the TwentyEleven Default theme for WordPress. You can find it in the Author Template. Common places to put this code is at the end of a post or at the top of an author archive page.
<?php echo get_avatar( get_the_author_meta( 'user_email' ) ); ?>
</div><!-- #author-avatar -->
<h2><?php printf( __( 'About %s', 'twentyeleven' ), get_the_author() ); ?></h2>
<?php the_author_meta( 'description' ); ?>
</div><!-- #author-description -->
</div><!-- #author-info -->
The code is pretty straight forward so here is a quick run down on its different pieces.
As mentioned before, in the WordPress Dashboard’s right sidebar there is a User section. There you can provide information about yourself that WordPress can pull if you get it to ask for it.
WordPress uses Gravatar to pull your avatar and Gravatar uses your email to associate your avatar to you. So on line 3 you see WordPress getting the author’s email and then Gravatar will bring in the avatar associated with that email.
On line 6 you see it asks for the User’s name. You can change this to the author’s nickname or display name in the dashboard.
On line 7 you see WordPress asking for the description that you would have put into the User’s section.
There are other bits of information that you can add to your profile in the WordPress Dashboard such as email, aim and twitter. Refer to this article on the WordPress Codex that deals with the call get_author_meta that we have been using.
The $field section of the article will give you all of the options you have. And because we all love examples here is one more example of how this would work.
<?php the_author_meta( $field, $userID ); ?>
This is what it would look like before you changed anything. You can see that you can also specify a specific user id for whoever’s aim or twitter you want to pull up. But if you don’t want to specify just drop the $userID.
So when calling the twitter info –
With the user ID:
<?php the_author_meta( 'twitter', 25 ); ?>
Without the user ID:
<?php the_author_meta( 'twitter' ); ?>
Check out this example of an author bio: