Displaying Author Pic and Bio in Your Wordpress Post the Non-Gravatar Way

Also see Enabling Author Pic and Bio for WordPress Single Posts for displaying an author bio box on a post by post basis.

A lot of sites/blogs out there have guest posts and/or multiple authors who contribute content on a regular basis. Now, there is nothing new with displaying the author name of a post, that snippet of code is just

<?php the_author(); ?>

and will simply display the authors name. We want to get a little more stylish and display a bio with an image, usually you can find a small bio of the article author before or after the post you are reading. 2 quick random examples can be seen below:

Steven Snell(Vandelay Design and DesignM.ag) is a contributer to the popular site PSDTuts, they do an author pic/bio before the article.

From Steven’s 20 Photoshop Painted Inspiration and Brush Resources

Author Bio - PSDTuts

Adelle Charles runs FuelYourCreativity.com in which she displays an author pic/bio after the article.

From Adelle’s Micromanaging a Creative

Author Bio - PSDTuts

Both of these examples display a little information about the author along with a link to the author’s site. Who doesn’t love some link love?!

Both are also are calling in the author’s Gravatar (Globally Recognized Avatar) that is linked to the author’s email*.

*For those who don’t know you can import an author’s image using the gravatar code:

<?php echo get_avatar( get_the_author_email(), '80' ); ?>

In which the author’s email will be checked with Gravatar, if the person has an account the image linked to their email will be displayed, exact same concept of pulling in avatars in the comments section of your favorite site.

But what happens if the author doesn’t have a Gravatar account?

Hmm…interesting.

Ok first thing first, make sure your author is listed as a “User” for your site. If they are not listed, create the account:

Go to your WordPress dashboard>>Users>>Authors>>Profile

Make sure the section for the Bio Info is filled out and while your at it make sure the First Name, Last Name and Nickname are filled out as well…they will come in handy later on.

Now open your Single Post php file, usually single.php. This page generates the layout of your article and is the file you need to edit in order to display some author info. For my example I added the author bio after the article, right before the share options and comments.

1
2
3
<div class="authbio">
<?php the_author_description(); ?>
</div>

Yikes, ugly but it works!

Let’s add some quick CSS to make it look somewhat respectable, you can always style away later!

1
2
3
4
5
6
7
8
9
10
.authbio{
color: #666;
font-weight: normal;
background: #fff;
border: 1px solid #ccc;
width: 420px;
height:60px;
padding: 8px;
margin-bottom:5px;
}

Okay, so now we are pulling in the author’s bio…what about the image?

Remember all the author fields you were suppose to fill out? First Name, Last Name, Nickname…if you didn’t do it, go do it now!

Let’s add these lines before your the_author_description in your single.php file.

1
<img src="<?php bloginfo('template_url'); ?>/images/<?php the_author_firstname(); ?>.jpg" alt="" class="alignleft"/>

Your author image and bio should now look like this:

1
2
3
4
<div class="authbio">
<img src="<?php bloginfo('template_url'); ?>/images/<?php the_author_firstname(); ?>.jpg" alt="" class="alignleft"/>
<?php the_author_description(); ?>
</div>

What the above means:

The above img src is looking for a file in your “Your Theme Stylesheet Directory/images” folder aka www.yoursite.com/wp-content/themes/ThemeName/images/.

php the_author_firstname is the first name used in the author fields under dashboard>>users>>profile

Please note that this is just returning what was entered into the First Name field and not the complete author name. Finally the extension “.jpg” is appended to the name.

Now you just need to upload a photo to your: www.yoursite.com/wp-content/themes/ThemeName/images/ and name the file exactly the same name you placed in the First Name Field in the author profile.

Throw in a little CSS to clear up the spacing

1
2
3
4
5
6
7
8
img.alignleft {
    float:left;
    background-color: #fff;
    border:1px solid #ccc;
    padding: 4px;
    margin: 0 7px 2px 0;
    display: inline;
}

And we are looking pretty much done!

Things to remember:

You can put links in your bio, no need to forget to link back to your site.

The above technique is looking for an image labeled the same as the “First Name” of the author. Also try the_author_lastname(); or the_author_nickname();

The technique above will provide a static solution for an author who does not have a Gravatar account. What is great about Gravatar is that the image will follow you wherever go as it’s linked to your email address. If you change your Gravatar image I believe it will be reflected everywhere you have left a comment, written a guest post etc. Using a Gravatar helps your personal branding to be consistent throughout the web.

Hope this is helpful, as I used it as a solution for an guest author who has an offline presence.

*
Share on Google Buzz

Share and Enjoy:
  • TwitThis
  • del.icio.us
  • StumbleUpon
  • Digg
  • Mixx
  • Reddit
  • Design Float
  • Facebook
  • Sphinn
  • Google Bookmarks
  • email
  • Print

48 Comments: Comment or Ping

  1. Tiffany

    Thanks for this post, this is exactly what I was looking for!

  2. Tox

    Thanks for share, I am looking for a long time

  3. @Tiffany
    @Tox

    Very welcome, glad this was found useful.

  4. Thanks for posting these helpful tips. This has been a great help for us at http://inspiks.com.

    Godserv’s last blog post..Flickr Group Graphics Roundup-January

  5. @Godserv

    Glad it could be used.

    Site looks great, you feature some very beautiful work.

  6. is this way will work if I put it in my first page, I usually do this in my author.php file, what if I want to display the biographical info on the main page…

    bara’s last blog post..[tanya]perangko Deutiches Reich

  7. @bara -

    For it to work on your main page for the posts that appear you would need to put the code in your loop. You are already pulling in the author names for posts and you could very well add the author image as well. Just style the image with css for placement. If you wanted to add the bio, you could do that as well within the loop.

  8. Rob

    Awesome post! Thank you!

    I’d like to put all my authors into an Author page, like this:
    http://theportablegamer.com/writers/

    But using the code you’ve put here on the site. Is there a simple way to do this? I assume it’s going to involve creating a different Page Template, and then putting some form of the code as above. What I don’t know, however, is how to get all of my authors to show up in such a page, without doing it manually. Thoughts?

    Again, thanks for a great tutorial!

    Rob’s last blog post..bleep. bloop. FREE — LED Football for $0.00 all Superbowl Weekend

  9. kookimebux

    Hello. And Bye. :)

  10. @Rob

    You can do this using Author Templates. Check out: http://codex.wordpress.org/Author_Templates basically you will create a Author.php page. In that page you will recreate the look of your archive or category template but instead of calling in posts you will be calling in your author’s info in the loop.

  11. yes! we found it! ahahahah… we did a little mod and placed the gravatar in with links to author’s articles. tell us how it looks. =)

    designeRoof’s last blog post..Mighty Wallet by Dynomighty

  12. This is great! Thank you for the insight on this… I think adding an ‘about the author’ bit with image and bio can make the author’s post more authoritative, and yet personal at the same time… (if that makes sense?) which is a good thing :)

    Leon Poole’s last blog post..Access iPhone – Theme for activeCollab

  13. @Leon Poole -

    I definitely think think it adds a personal touch to any article plus if you have a guest writer, it’ good promotion.

    Glad you found a use for this, but don’t forget you can also use gravatars if all your authors are signed up with an account.

  14. Great post – lovin’ it. Made my corporate blog what it needed to be… Thanks much!

    James’s last blog post..How To Post In WordPress, The Basics

  15. @James -

    Glad to help! Gravatars are the easiest to implement but not everyone has one which is why I needed something like this to aid in helping to promote offline authors.

  16. What an inspired solution.. just what I was looking for! Author bio pic should really be built into WP but until it is this is the perfect solution! Thanks!

  17. Just what i needed. Awesome work. Thanks! :D

  18. How can I make it so that the author bio doesn’t show up on each page of a multipage article? I want to show it only on the very last page.
    :)

  19. Kim

    Thanks for this, it’s a huge help. If you ever see our pics and bios up on our blog, you’ll know who made it possible!

  20. @Kim -

    Glad it can be of use!

  21. Hi,
    Thanks for such a great tutorial. I being a non technical person never thought of doing this all by myself !
    However 2 things i still couldnt find in your tutorial:
    1. Author name is not being displayed ( with a link to his posts )
    2. How do i add other things like, twitter link, facebook link, etc ?

  22. Good article, clearly laid out explanation too.
    Rob H´s last blog ..Free vector social bookmarking icons My ComLuv Profile

  23. Pavlin

    Hi, Why links in author bio can’t have target blank?

    When I insert a link in my bio, however I type it, it just removes the target=”_blank”

    how can I make my links to open in blank page?

    please help ;)

  24. Pavlin

    nevermind I made it

    The issue here was that a user’s description allows very little HTML

    I’ve just allowed full html and the links are working now

  25. @Pavlin –

    Good to hear you solved your _blank issue!

  26. Jim

    After hours of searching, these instructions you provided did the trick. I can’t thank you enough!

  27. Awesome man !!!
    It works…..

  28. This is brilliant, thanks so much! I’ve now got to finish my bio and I’m done!
    Laneth Sffarlenn´s last blog ..Coming Soon from Sffarlenn.net My ComLuv Profile

  29. Glad people are still finding this useful :)

  30. Works perfect in Firefox but the author description doesn’t display nor does the author image display in IE.

    Is this a known issue and do you know a fix for it?

    Thanks
    Mark´s last blog ..Video: Footage from Above 2010 Icelandic Volcano My ComLuv Profile

  31. @Mark – I checked your site, doesn’t seem to work at all in IE or Firefox. Your site is looking for a thumbnail called http://www.techiezine.com/wp-content/themes/tztheme/images/James.png which doesn’t exist in your folder. Make sure when you upload the thumbnail it’s labelled to match the info put in the Profile fields under Users.

    There shouldn’t be an issue with IE vs Firefox because we are just using a normal WP reference to call the info. Double check your code and if you are still have issues feel free to drop me a line.

  32. Hey! just want to say thanks, this has been a great help! R

  33. At last I found the solution here! Thanks! :)
    Shafar´s last blog ..Longtails Ranked For With Correct Permalink Structure My ComLuv Profile

  34. @Rhys & @Shafar – Enjoy!

  35. Adam

    Thanks for the great and easy tutorial!

    I saw someone had a question about this above. Here is the code I used to display the author info above the box and added the author’s email and Twitter link (I put the author’s Twitter URL in the AIM area to make this work):

    Article Written By:

    <img src="/images/.jpg” alt=”" class=”alignleft”/>

    <a href="mailto:”>Email

    <a href=" “>Follow on Twitter

  36. This is great! I am trying this out :) Couldnt find any plugin to make this work so yeah, definitely have to code it
    Cindy´s last blog ..Comment on Set up Nivo Slider in WordPress as a text widget by z3olyteMy ComLuv Profile

  37. @Adam & Cindy – Enjoy! If anyone runs into any issues just leave a comment or send me an email!

    Trackbacks

Reply to “Displaying Author Pic and Bio in Your Wordpress Post the Non-Gravatar Way”

CommentLuv Enabled

Contact

Questions, inquiries or just feel like getting in touch, feel free to do so: