Creating an Author Template in WordPress
Wednesday, August 26th 2009Each user needs a landing page that displays all the user meta from her profile. Thankfully, WordPress has already accounted for this, because when the application requests an author by ID (?author=#), it looks for the following templates in this order:
- author.php
- archive.php
- index.php
All we need to do is make an Author template:
<?php get_header(); ?>
<div id="content" class="narrowcolumn">
<?php
if(isset($_GET['author_name'])) :
$curauth = get_userdatabylogin($author_name);
else :
$curauth = get_userdata(intval($author));
endif;
?>
<h2>About: <?php echo $curauth->nickname; ?></h2>
<dl>
<dt>Website</dt>
<dd><a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a></dd>
<dt>Profile</dt>
<dd><?php echo $curauth->user_description; ?></dd>
</dl>
<h2>Posts by <?php echo $curauth->nickname; ?>:</h2>
<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>,
<?php the_time('d M Y'); ?> in <?php the_category('&');?>
</li>
<?php endwhile; else: ?>
<p><?php _e('No posts by this author.'); ?></p>
<?php endif; ?>
<!-- End Loop -->
</ul>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Pretty nifty, huh? It even has the kindness to display a loop of posts authored by the user. All this thing is doing is dumping the user's meta into $curauth, so that you can request individual profile fields by echoing
"$curauth->name_of_your_field;" this will come in handy later when we make our own custom meta.

This was the fifth page I looked at on author pages, and by far the most helpful. Many thanks!
Glad it helped.