Simple Guide to Creating Custom Author Templates With WordPress 3.0

Custom author templates can be a great enhancement to a multi-author blog where you want to implement unique styles for one or more blog authors. WordPress 3.0 makes customizing author templates easier than ever. It’s now similar to the way you might create a unique category template: ie. category-news.php and it’s new to 3.0.

How to include a custom author template file:

WordPress first will look for one of the following:
author-{nicename}.php
author-{id}.php

If neither of these are present, it will then look for author.php followed by archive.php and then index.php.

Step 1: Create the author-{nicename}.php file.

The easiest way is to copy the archive.php file and then add or change whatever you want to in that file. Save it as an author template file, ie.:

author-walter.php

Step 2: Upload the file to your theme’s folder.

Now you can check out your custom template by visiting the author’s archive you customized. For example:

http://yourdomain.com/author/walter/

This is an example of a custom author template page added to the BuddyPress default theme:

The above example uses the basic archive.php template for BuddyPress with an added tag to include Biographical Info for the user at the top before the posts. Include this snippet in your archive.php file to show author info:

1
2
3
4
5
6
7
8
9
10
11
12
<div id="authorbio">
<?php 
if(isset($_GET['author_name'])) :
    // NOTE: 2.0 bug requires: get_userdatabylogin(get_the_author_login());
    $curauth = get_userdatabylogin($author_name);
else :
    $curauth = get_userdata(intval($author));
endif;
?>
<h4>Walter's Bio:</h4>
<p><?php echo $curauth->user_description; ?></p>
</div>

How to customize the template will be up to you. You can add particular CSS classes, unique backgrounds, a quick bio at the top of the page, custom author information, or anything you want to make the page different from your default archives.

Further Details and More Information

Please note that the custom author templates will only work with WordPress 3.0 and will not be applicable to earlier versions. You can find more detailed information about how to create unique author templates, tags you can include, and a sample template in the WordPress codex section on Author Templates.

Featured Plugin - WordPress Facebook Plugin

Would you like to add Facebook comments, registration, 'Like' buttons and autoposting to your WP site? Well, The Ultimate Facebook plugin has got that all covered!
Find out more

Featured Plugin - WordPress Newsletter Plugin

Now there's no need to pay for a third party service to sign up, manage and send beautiful email newsletters to your subscriber base - this plugin has got the lot.
Find out more

Featured Plugin - WordPress Infinite SEO Plugin

Fully integrated with the SEOMoz API, complete with automatic links, sitemaps and SEO optimization of your WordPress setup - this is the only plugin you need to help you rank your site number 1 on Google - nothing else compares.
Find out more

Featured Plugin - WordPress Wiki Plugin

To get a wiki up and running you used to need to install Mediawiki and toil away for days configuring it... not any more! This plugin gives you *all* the functionality you want from a wiki, in WordPress!!!
Find out more

Featured Plugin - WordPress Q&A Site Plugin

It's now incredibly easy to start your own Q&A site using nothing more than WordPress - The Q&A plugin simply and brilliantly transforms any site, or page, into a perfect support or Q&A environment.
Find out more

Featured Plugin - WordPress Ecommerce Shopping Cart Plugin

Out of all the WordPress ecommerce plugins available, MarketPress has got to be the winner - easy to configure, powerful functionality, multiple gateways and more. A simply brilliant plugin!
Find out more

Featured Plugin - WordPress Google Maps Plugin

Simply insert google maps into posts, sidebars and pages - show directions, streetview, provide image overlays and do it all from a simple button and comprehensive widget.
Find out more

Featured Plugin - WordPress Appointments Plugin

Take, set and manage appointments and client bookings without having to leave WordPress. Appointments+ makes it easy.
Find out more

Featured Plugin - WordPress Membership Site Plugin

If you're thinking about starting a paid, or just private, membership site then this is truly the plugin you've been looking for. Easy to use, massively configurable and ready to go out of the box!
Find out more

Comments (4)

Participate