June 23, 2007

WordPress Author pages

I was asked in Make your WordPress blog a real website how to make Author pages for WordPress. This would be a page for each author that displays his/her name, description, etc.

To make an author page, just create an author.php in your theme (and remember to upload it); the code should be something like this:

<h1 class="h2">Posts by <?php echo $curauth->first_name; ?> <?php echo $curauth->last_name; ?></h1>

<p><?php echo $curauth->description; ?><br />
Website: <a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a></p>

<p><?php echo html_entity_decode(get_the_author_description()); ?></p>

<ul>
<!– The Loop –>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<li><?php the_time(‘m-d-y’); ?>:
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a>
&raquo; <?php the_category(‘&’);?>
<?php // the_excerpt(); ?>
</li>

<?php endwhile; else: ?>
<p><?php _e(‘No posts by this author.’); ?></p>

<?php endif; ?>
<!– End Loop –>
</ul>

Then add this in your sidebar (the top):

<?php /* If this is the frontpage */ if ( is_home() || is_page() || is_single() || is_category() || is_day() || is_month() || is_year() || is_search() || is_404() || is_author() ) { ?>

and this in the sidebar links:

<ul>
<?php wp_list_authors(‘show_fullname=1&optioncount=1′); ?>
</ul>

You can see it in action in our new site, We Want Organic Food! (although I’ve got a stack of already-written posts to add there, here’s the reason I started the organic food site, in case you’re wondering). Here’s an author page there.

The author page descriptions come from the users’ descriptions in the WordPress admin panel — although WordPress strips out any links they may post there. There are instructions in the WordPress forums about how to allow links in Author descriptions, although I haven’t decided whether that solution is a good idea.

And that’s it. You can customize the sidebar and other elements further, but those are the basics.

6 Comments to "WordPress Author pages"

  1. GilbertZ says:

    Excellent. Thank you.

  2. Wordpress plugins and hacks | ChillyCool Web Digger says:

    [...] How to make WordPress author pages Subscribe to the RSS feed or get email updates var bz_url=’http%3A%2F%2Fchillycool.com%2Fwordpress-plugins-and-hacks%2F’; var bz_num_comments=0; var bz_comment_date=”; var bz_bgcolor=’fff’; [...]

  3. Wordpress plugins says:

    [...] WordPress plugins – 07-03-2007, 06:23 PM I find myself using WordPress a lot for development, but what’s really great about it is the wide range of plugins available to really enhance your WordPress install. I ran a number of searches on Google this morning, looking for specific plugins, but really some of the best WordPress plugin resources are lists already compiled elsewhere. Anyway, here are some of the plugin lists I was browsing today – will post them here so I don’t forget. Top WordPress Plugins for the Smart Blogger Top WordPress Plugins And some nice individual plugins: WP-Cache Sure Form Mailer PXS Mail Form WordPress Theme Generator How to Create Author Pages Anyway, I’ll add to this as I come across them. [...]

  4. David says:

    I don’t know how to code. Is there something that can be added so that for example in my sidebar only the top 10 authors (in terms of blogs posted) are listed and below the last one there is a “more authors link”

    I have a lot of authors in my site and the sidebar is too populated with all the author names and I would like to reduce the number of author links shown in the sidebar. Please help!

    thanks

  5. Diane Vigil says:

    David, I took a look at the WordPress codex, and it looks like what you want is on the Author Templates page.

    Take a look at the section entitled “List of Authors with Links” — the second code example there should do what you want to do.

    There may be a less code-laden way to do it; if so, you might inquire in the WP forums.

  6. Wordpress plugins and hacks — Blog a Living says:

    [...] How to make WordPress author pages [...]

Have your say ...

First-time comments will be held for moderation (but comments are appreciated). Otherwise, just be courteous. If your name is a bunch of keywords, your comment will be deleted. Don't post links unless highly pertinent. Posters must be 16 or older.

Manage your subscriptions

Archives
© 2004-2014 DianeV Web Design Studio. All Rights Reserved.
33 queries. 0.202 seconds.