WordPress

WordPress: Add Author Information in Sidebar

UPDATE: I’ve developed a Sidebar Widget to display your Author Information.

Today’s post by Jon Arnold was fantastic on tips for designing a website, but I noticed the first comment attributed the post to me. That’s a telltale sign I need to make the author information more prominent.

I’ve not created a widget for this (and I’m surprised that no one else has!), but I was able to edit my sidebar in my WordPress blog theme and add the following code:
<?php if(is_single()) { ?>
<li class="the_author"><h3 class="widgettitle">About the Author</h3>
<?php echo get_avatar(get_the_author_meta('user_email'), $size = '96'); ?>
<h4><a href="><?php the_author_meta('user_url'); ?>">
<?php the_author_meta('display_name'); ?></a></h4><p>
<?php the_author_meta('description'); ?></p></li><?php } ?>

On a single post page, an additional sidebar section is added that has a photo of the author (using a gravatar), their full name, their home page and their bio information as described in their user profile. I added a couple classes to handle ensuring the gravatar floated to the left and the height of the section had a minimum height in the event an author had no information.

get_the_author_meta(’email’) retrieves the email address of the author and passes it to the get_avatar function. The get_avatar function translates the email into an identifier that’s passed to the gravatar server to post the appropriate image. This is essential since you want to avoid making an email address available in the source of the page… spammers love to harvest emails.

The other data is retrieved simply using the_author_meta information.

Download a Sponsored Marketing Whitepaper:
Master eBook Guide: Driving Growth with Marketing Automation

Master eBook Guide: Driving Growth with Marketing Automation

Everything you could want to know about your marketing automation strategy and system, from A to Z ... Download Now

6 Comments

  1. 1
  2. 2
  3. 4
  4. 5

    Do you intend to host that at wordpress.org so we could receive updates?

    and as a seconde question: if I want to display e.g. AIM only when it is filled in, can I use the same codes to do that or will that render like this: "AIM: " I'd like it to display nothing if the output is empty…

    I will probably modify your plugin for my page to display the bio and a little extra information: contact like icq, aim, xfire and so on.

  5. 6

    Douglas,
    What a terrific idea your widget adding a sidebar gravatar is. (I've got to confess I didn't even know the term gravatar, until I followed your link to find out – thanks). I'm definitely going to install your widget on a site of mine.

    BTW, lots of great information on your site, I'm really glad I found it.

This site uses Akismet to reduce spam. Learn how your comment data is processed.