Due to the small number of WordPress blogs that have multiple authors, very few WordPress themes seem to come with a custom author page. This means whenever someone goes to the author page, WordPress will by default use your archives.php file, or if that isn’t available, then use your index.php file. This generally doesn’t make for a very nice author page because it just displays that authors posts in the same format as your archives.

In order to create an author page, you will want to make a copy of your archives.php file and name it author.php, then upload it to your site via FTP. Now go into your theme and edit the author.php page you just created. From here, it will vary a little bit depending on your theme, but we basically have to redo the post loop for this page. A typical archive page will call the header, then finish with calling the sidebar and footer. We will be changing the code in between. Here is the code that a standard theme would use between the header and sidebar/footer calls:

<div id="content" class="narrowcolumn">
<!-- This sets the $curauth variable -->
<?php
if(isset($_GET['author_name'])) :
$curauth = get_userdatabylogin($author_name);
else :
$curauth = get_userdata(intval($author));
endif;
?>
<h3>About: <?php echo $curauth->display_name; ?></h3>
<p><strong>Website:</strong> <a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a></p>
<p><strong>Profile:</strong> <?php echo $curauth->user_description; ?></p>
<h3>Posts by <?php echo $curauth->display_name; ?>:</h3>
<ul>
<!-- The Loop -->
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<li>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>">
<?php the_title(); ?></a>
</li>
<?php endwhile; else: ?>
<p><?php _e('No posts by this author.'); ?></p>
<?php endif; ?>
<!-- End Loop -->
</ul>
</div>

This will display the author’s nickname, their website, and whatever is in the description field, as well as a bulleted list of all their posts. Once set up, you can control everything from within your Users panel of your WordPress dashboard. To see a list of other arguments you can get, I recommend checking out the official WordPress Author template.

As an added bonus, if you want your authors name link to point towards the authors page, you can do so with the following code:
<?php the_author_posts_link(); ?>

Want automatic updates? Subscribe to our RSS feed or
Get Email Updates sent directly to your inbox!
Tweet This | Digg This | Stumble it | Add to Del.icio.us | | Print This

Kyle Eslick

Kyle Eslick is the founder and primary author of WordPress Hacks. You can learn more about him at KyleEslick.com or you can follow his personal tweets here.

There Are 25 Responses So Far »

  1. Gary R. Hess says:

    Awesome. This may come in handy if I ever feel the need to add additional authors to my site.

  2. amar says:

    Great!
    but I think some thing missing here
    How I can tell wordpress to use authors.php page I just created not the archives.php as usually?
    because I create authors.php but no changed happened in my blog?

  3. amar says:

    hi again
    you have simple mistake in your post
    it is “author.php” not “authors.php”

    thanks a lot

  4. Kyle Eslick says:

    Amar – Thanks for the correction! I have updated the post accordingly.

    Glad you both found the post useful!

  5. Rosyidi says:

    but, how to add a link to all users author?

  6. Kyle Eslick says:

    @ Rosyidi – Can you clarify your question?

  7. HyperGripe says:

    Thanks so much!! This worked sweet… I am building a kind of social networking complaint site, and this was perfect for creating user profile pages… was very easy to implement.
    Thanks again!

  8. Zach Katkin says:

    Having trouble implementing. Copy archives page, add code in appropriate spot, but only a blank white page shows. Any assistance would be greatly appreciated. By the way… love your theme!

  9. Kyle Eslick says:

    @ Zach – Thanks! Can I get some more information? It looks like some others above have successfully completed this hack, so there is probably just some minor piece of code missing.

  10. Zach Katkin says:

    Thanks for getting back to me so quick Kyle. I was able to get it to work. I’m now looking at a way to output the authors description formatted.

  11. sandeep mt says:

    I managed to get the “posted by” link on the frontpage. but when i clicked the post the authers name is not there?
    how to link authors name and profile in every post he writes?

  12. Hi,

    Thanks for this tutorial. I just did what you said in your post. But I am not sure how to call / link this author page?

  13. Erik says:

    Hey…the link works, but I am getting a parse error at

    Fixes? Thanks!

  14. Erik says:

    Sorry…this line:

  15. John says:

    HAHA! Awesome! This was exactly what I needed! To anybody who get’s the blank page after calling the author.php file, it’s because you need to go into to your author.php file and make it look just like your archives.php/index.php file. All you really need to do is make sure you include the following piece of the code as the first thing inside your “content” div:

    Hope that helps!

  16. John says:

    Woops, I should’ve known the code wouldn’t show up. I meant to copy lines 2 through 9 of the example code.

  17. Randy says:

    Hello:

    I am using Revolution Lifestyle and followed the instructions with the resultant error:

    Parse error: parse error, unexpected T_STRING in /home/content/c/o/a/name/html/wp-content/themes/lifestyle_20/author.php on line 24

    Help please.

  18. Greg says:

    Thanks for this. Any thoughts on how to include a short bio and picture as well?

    For example, I’d like to have all the author information at the top, followed by the bio, then a link to the posts by the author (not the actual posts themselves).

    My issue is figuring out how and where to store the bio and photo.

    Thanks!
    Greg

  19. Thank you so much for this write-up! I have been trying to do this for weeks, and yours is the first set of instructions I’ve been able to follow and implement.

  20. spacefem says:

    This worked for me, but only after I changed the quotes around ’No posts by this author.’ to straight quote (‘No posts by this author’). If you’re just getting a blank page, it might be that that’s your parse issue and you don’t have PHP notices on to tell you. Try that route before you reconfigure for notices.

  21. Nick Aster says:

    Anyone know how to make exceptions for certain specific authors? LIke, author id=5 should have a special page that’s different from all the other authors…

    ideas?

  22. nick says:

    just discovered the joys of WP – being non-techie legals – but horror of horrors – after getting everything running well – the domain neaglelawyers.com.au masking our WP.com site and the Googles Apps dedicated beta email and adwords – i then roll in to office and smugly do Google search for neagle lawyers to only find absurdly long archive page thing where my clean opening page shouldve been…any pointers as to how to get the domain to direct to the actual masked neaglelawyers.com.au cleanly as i guess this will throw the adwords now as well..

    cheers for any forums etc I should monitor/ or advice..

    Nick

  23. This worked perfectly for me. How Can I get it to display more than 5 posts by the author?

  24. K77 says:

    Hello!

    Thanks for this.. I was having a problem before I wanted to display an author wordpress box like psd.tutsplus.com but it kept looking the author box because of the wordpress “the loop” I just wanted to show a box and then loop the authors posts!

    Thanks for this!

  25. Kaiserlino says:

    Worked just fine…
    But now a simple question..
    And if i want to make a totally diferent page for just a single author.
    like we do with posts or categories.

    Already tried using author-ID.php and author-slug.php, but none worked.
    Is there any way?

Trackbacks/Pingbacks »

Leave a Reply