Most themes do not come with a dedicated page for authors. Under the Template Hierarchy, WordPress will instead look for an archives.php template or an index.php template if an author.php template is not found in the theme directory. This means that the summary of an author’s posts will be shown in exactly the same way that monthly and category archives are shown.
What’s on the Author’s page?
Although this way shows all of the author’s previous posts, it doesn’t tell you much about the author themselves. If you have many authors writing for your blog, you should perhaps consider creating a dedicated authors page for them in order to give them more exposure. For best practices, add a authors photos and a concise and descriptive bio about the authors that helps readers understand who these authors or editors are. Many websites also links to the authors social media pages
Creating the Authors page on WordPress
We start by creating a file called author.php. It is important that the file has this exact name as WordPress looks for that before archives.php and index.php.
The most common way of developing an authors page is by using a variable called $curauth (an abbreviation of Current Author). This is the method which WordPress itself promotes.
So to start we need to set this variable so that WordPress can call up the correct information for our user. The code below needs to be placed in our template before the WordPress Loop.
If the above code doesn’t work (which may be the case if you are using an older version of WordPress), you should try one of the other ways which WordPress suggests.
Once you have added the above code, you can call up any of the functions below:
* Please note, some of the functions above won’t work in versions lower than WordPress 2.0.
What you add to your author.php file is really up to you. As you can see from the above list, there are a lot of functions you can call upon.
Here is an example of how you could list an authors email on author.php file.
You should now have a basic understanding of how to build the author.php file. WordPress have a great example of an author.php file. You can see this example below:
Of course, your own author.php will look a little different (since the structure of all themes are a little different). Though the example above should illustrate how easy it is to create an author page.
Some important things to note about the author.php file:
- Other than setting up the Current Author variable ($curauth), the author.php is very similar to the page.php template. Therefore, I recommend adding the code from the page.php template and stripping it down to suit the author.php page. Please read my article ‘How to create a page shell‘ for more information on this.
- You will notice that the WordPress Loop is only called upon to display the authors posts. Basic information about the author such as name and email etc should be called outside the loop. The loop itself would not be needed if you are not listing the authors posts within the file, though I believe most of you should use it.
Linking to the Authors page
Once you have created your authors page, you need to link to it within your site. The most useful place to link to an authors page is within an articles information area (i.e. the area which states the date the article was published, what category it was placed under etc).
If you want to link to an author page from your home page, you need to edit your index.php template. If you want to display it on a blog post, you need to edit your single.php template. Lastly, if you want to link to an author page from a page (i.e. a WordPress page not a post), you need to edit the page.php template.
To link to an authors page in any of the above templates, all you need to do is use the the_author_posts_link Template Tag within the WordPress Loop. For example, you could add something like this to your template:
Note, the name which is displayed is the name which is entered in a users ‘Display name publicly’ field, which can be found on their profile page. Again, make sure the above tag is used within the WordPress Loop.
Another useful Template Tag is wp_list_authors. This tag can be used outside the WordPress Loop (For example: it could be used in your sidebar or your footer).
The tag simply lists all authors authors in a list. By default, admin is excluded from this list though it is possible to show admin posts as well by setting the exclude_admin parameter to false. Please check out the wp_list_authors information page for more details of the parameters you can use with this tag.
Conclusion on Authors’ Pages
The authors page is something which is not usually included in themes so if you would like to present more information about your writers you will probably need to create the template yourself from scratch.
Please note, most single author websites and blogs don’t need to create an author template, though it’s worth adding if you regularly have guest posters or if several authors write on the same blog.
As always, please let me know if you are unsure about any of this.