A Recipe to Enhance Your Article Footers

b82014d54604f4c9236673092b59e5f0 0 Del.icio.us

If you like the author information at the bottom of this post then you’ll love today’s article.  The following code will provide you with the ability to show off the avatar, the biography and the post count of the author of each article on your site.

I’m sure many of you may not be familiar with xhtml, css or php but I assure you that this guide will walk you step by step through the process of installing this on your website.  It’s really just a bunch of copying and pasting. And if you have any questions simply leave a comment and I’ll jump in and help you out.

1.  Open up your wordpress theme file named single.php and look for the following line of code:

<?php the_content(); ?>

2. Past the following code just below the above mentioned line.  Create a new line if necessary.

<span style="float:left;margin:0 10px 0 0;">
<?php $author_email = get_the_author_email();
echo get_avatar($author_email, '140'); ?></span>
<h4 style="font-size:2em; color:#775F55;">
<?php the_author_posts_link(); ?></h4>
<p><?php the_author_description(); ?> 
<?php the_author(); ?> has <?php the_author_posts(); ?>
post(s) at Site Sketch 101</p>
<div style="clear:both;"></div>

Be sure to replace Site Sketch 101 with the name of your own blog. If you want to adjust the size of the avatar then simply replace the 140 with the number of your choosing.

If you have any trouble working on it just leave me a comment and let’s figure it out together.

Additional Information:

A special thanks to Glen from Happy and Blue 2 for providing this follow up advice to people using this recipe.

I would only add that you need to do the following:

Once you have pasted the code into your single.php file, in your WordPress admin area go to ‘Users/ Your Profile’.  Under Name change your nickname to your name (or whatever name you wish to appear).  Under About Yourself- Biographical Info add in the message you want to appear at the end of each post.

Share your Opinion

and be a part of the discussion.

  1. Name (required)

    Mail (required)

    Website
    Your Comment

31 Vibrant Comments

I would love to hear yours!


  1. January 14, 2010

    Ruth - Web Career Girl said:

    Great tip! I have never had any other author write on my blog, but I was just thinking today how it’d be nice to have a note at the end of my posts about who I am, to help readers get to know me if they haven’t read my ‘About’ page.
    My Latest Blog Post: The Benefits of Fixed Working Hours in Your Web Career


    • January 16, 2010

      Nicholas Cardot said:

      Ruth – Web Career Girl » This is great because it will show off information about you or another author so even if you do ever have a guest author at your site then you’ll be ready for them.


  2. January 14, 2010

    Don Gilbert said:

    Great post – I just implemented something similar to this on my blog. However, I did it a little differently. I pulled this from the Gravatar website and modified it a little bit for my purposes. You can see it in action at the bottom of every post on my blog.

    Instead of placing this code in your single.php, you can add it to your functions.php (or your custom_functions.php if you use Thesis.)

    The add filter method attaches it to the end of content, whether page or post, or frontpage. I added the if(is_single()) so that it only shows up on the individual pages/posts.


    function get_author_bio($content='') {
    global $post;
    if (is_single()) {
    $post_author_name=get_the_author_meta("user_firstname");
    $post_author_description=get_the_author_meta("description");
    $post_author_url=get_the_author_meta("user_url");
    $post_count=get_the_author_posts();
    $html="n";
    $html.="n";
    $html.="n";
    $html.="
    n";
    $html.="n";
    $html.= $post_author_description."";
    $html.= " ".$post_author_name." has blogged ".$post_count." posts here.";
    $html.="n";
    $content .= $html;
    }
    return $content;
    }
    add_filter('the_content', 'get_author_bio');

    Also, I styled mine a little with CSS. Just add this to your theme’s CSS file.

    .author_bio{padding:10px;border:#D7D7D7 1px solid;background:#EEE;}
    .avatar {padding: 12px 12px 0pt; float: left;}
    .bio_post_count{text-align:right;margin-bottom:0;}


    My Latest Blog Post: Top 10 Tips to Dominate Your Niche for SEO


    • January 16, 2010

      Nicholas Cardot said:

      Don Gilbert » That seems like a lot of extra work. Thesis doesn’t have a single.php?


      • January 16, 2010

        Don Gilbert said:

        Actually – no. It doesn’t. Seems wierd, right?

        Well, if it did have a single.php, then every time you upgraded Thesis, you would have to redo the hack. That’s why you put it in the custom files, and just copy them over to the upgrade installation.

        That brings up another point, everytime you change you theme or of your theme author comes out with an update to your theme, you will have to redo the hack.

        That’s why it is better to use plugins and custom.php files rather than modifying core files (wordpress, themes, or otherwise.) That’s one of the reasons I made it into a plugin.

        My plugin (mentioned above) is now on the wordpress Plugins directory. I uploaded it this morning, so it may take just a little while for it to update and actually show – but it will.

        Here’s the link.
        Featured Blog Author
        My Latest Blog Post: Top 10 Tips to Dominate Your Niche for SEO


  3. January 14, 2010

    Don Gilbert said:

    [code]
    How do you leave code in your comments?
    [/code]
    My Latest Blog Post: Top 10 Tips to Dominate Your Niche for SEO


  4. January 14, 2010

    Aminul Islam Sajib said:

    Thank you very much, Nick. This is gonna help me out although I still have no guest author :(
    My Latest Blog Post: PrtScr: The Easiest and Simplest Tool to Take Screenshots


    • January 16, 2010

      Nicholas Cardot said:

      Aminul Islam Sajib » That’s all right. This will be great to help people understand who you are and then when you do eventually bring on some guest authors, you will be ready to feature their information as well.


  5. January 14, 2010

    Glen said:

    Thanks for this. I tried this out on my test site and it worked perfectly.

    I would only add that you need to do the following:

    Once you have pasted the code into your single.php file:

    In your WordPress admin area go to Users/ Your Profile

    Under Name change your nickname to your name (or whatever name you wish to appear).

    Under About Yourself- Biographical Info add in the message you want to appear at the end of each post.

    Once again, thank you for sharing this Nickolas. Much appreciated..


  6. January 14, 2010

    Lee Ka Hoong said:

    Thanks for the coding Nicholas, I would like to change my author section like yours too. Between, is this coding working for Thesis Theme as well?

    Best Regards,
    Lee


  7. January 14, 2010

    Keith said:

    Great info! I wondered how people were getting there author info on the posts!

    Took a little playing around to get it where I wanted it, but thanks!
    My Latest Blog Post: Using KeywordLuv Plugin


  8. January 14, 2010

    Deepika said:

    Nice post.. I have author bio in my blog for every post. But it only show the number of articles i wrote.. I was searching how to add bio… Thanks for sharing it..

    I will try this and inform you after installing this code in my blog.
    My Latest Blog Post: How To Lead Stress-Free Blogging Life


  9. January 14, 2010

    Eric said:

    Nick,

    I copied and pasted the code and it went to a page that said my blog could not be found.

    I’m not quite sure what I could have done wrong exactly.

    I like the idea of this and would like to use it if I can get it to work. Thanks!
    My Latest Blog Post: The Most Money You’ll Ever Make With Your Blog


  10. January 14, 2010

    Chad @ Tech201 said:

    Good stuff, Nick. I’m sure people see stuff like this on SS101 as well as other sites, and wonder how they can recreate it on their own site. Your post makes it easy to digest & understand, and that will make others more inclined to do it.

    Now you’re talking about ‘How to Blog’ for the masses! ;)

    Cheers.
    My Latest Blog Post: Be Your Family’s Tech Support Hero With LogMeIn


  11. January 15, 2010

    Harry said:

    Thank you for this Nicholas! Great info and, if we play with it a little bit, customizable.

    How would you go about adding it right after your article though like you are doing here? I have a plugin with similar content running and it always shows up above the author description.

    Any ideas?
    Thanks again!


  12. January 22, 2010

    mk akan said:

    i was actually struggling to set something similar with an rss footer plugin..this was very helpful.let me see if i can handle it from here.
    My Latest Blog Post: 6 Reasons Why You Need To Take Blog Commenting Seriously


  13. January 24, 2010

    Rose said:

    I was wondering how that was being done, but no one would tell me. lol
    My Latest Blog Post: How to Use Google Wonder Wheel


  14. January 25, 2010

    Self Improvement said:

    Hey Nicholas, you wrote the code yourself? Man, it’s really helpful when you know coding. I love the design of this blog by the way. It makes me want to keep reading and reading…
    My Latest Blog Post: How To Get More From Life This Instant


  15. May 20, 2010

    Dvd Player And Recorder said:

    Hi. I wished to drop you a rapid note to express my appreciate it. I have been following your online site for a month or so and have picked up a ton of greatly information as stupendously as liked the way in which you’ve structured location. I’m attempting to operate private web but I think its too standard and I want to concentrate absolutely on scaled-down topics. Being all things to all various is not all that its cracked up to be.