Add Author avatar and bio to post WordPress

Did you notice that here in Developer's Blog you can see the Author avatar and Bio right after the post?

Jexweber asked me on Twitter How did you do that?.

Well this is not a plugin it's just a few lines of code.

1. Open you single.php file of your theme.

2. Now place the functions (below) inside the Loop.

Look for the post content and put it after it. Then you will be sure is inside the Loop:

<?php the_content(); ?>

3. Add the functions

Get the Author avatar:

<?php echo get_avatar(get_the_author_id(), 60); ?>

Get the Author posts link:

<?php the_author_posts_link(); ?>

Get the Author Bio:

<?php the_author_meta('description'); ?>

(please notice the field description must be filled in the author profile page)

What else?

You can style the output with tables, divs and CSS.

Enjoy it πŸ˜‰


Leave a Reply

Add <code> Some Code </code> by using this tags.