How to Create a Kickass WordPress Authors Page

If you run a blog with multiple authors, it’s a good idea to have a list of all authors on a page with a few lines about them and a link to their twitter profile. I found many large blogs not following that. Few of those who follow includes Techcrunch.

Running a multiple author WordPress blog? Lets get your authors page setup real quick. I have written a flexible WordPress page template that will support most themes. To be sure, I tested it on WordPress default theme. If you follow WordPress default theme pattern, you will have no trouble setting this up.

The page template lists all authors ordered by author ID. The format of a listing is author name followed by author description and gravatar which is followed by a link to recent post and finally links to social media profiles. The page template supports twitter, facebook, linkedin, digg and flickr.

Example Listing with Sample Text and only Flickr Link

Installation Instructions

  1. Download and extract authors.zip
  2. Copy and paste authors.php file to your theme directory
  3. Copy and paste the following code on the top of your functions.php file in your theme directory (this will add social media profile fields on edit profile page)
    <?php
    add_action('show_user_profile', 'wpsplash_extraProfileFields');
    add_action('edit_user_profile', 'wpsplash_extraProfileFields');
    add_action('personal_options_update', 'wpsplash_saveExtraProfileFields');
    add_action('edit_user_profile_update', 'wpsplash_saveExtraProfileFields');
    
    function wpsplash_saveExtraProfileFields($userID) {
    
    	if (!current_user_can('edit_user', $userID)) {
    		return false;
    	}
    
    	update_usermeta($userID, 'twitter', $_POST['twitter']);
    	update_usermeta($userID, 'facebook', $_POST['facebook']);
    	update_usermeta($userID, 'linkedin', $_POST['linkedin']);
    	update_usermeta($userID, 'digg', $_POST['digg']);
    	update_usermeta($userID, 'flickr', $_POST['flickr']);
    }
    
    function wpsplash_extraProfileFields($user)
    {
    ?>
    	<h3>Connect Information</h3>
    
    	<table class='form-table'>
    		<tr>
    			<th><label for='twitter'>Twitter</label></th>
    			<td>
    				<input type='text' name='twitter' id='twitter' value='<?php echo esc_attr(get_the_author_meta('twitter', $user->ID)); ?>' class='regular-text' />
    				<br />
    				<span class='description'>Please enter your Twitter username. http://www.twitter.com/<strong>username</strong></span>
    			</td>
    		</tr>
    		<tr>
    			<th><label for='facebook'>Facebook</label></th>
    			<td>
    				<input type='text' name='facebook' id='facebook' value='<?php echo esc_attr(get_the_author_meta('facebook', $user->ID)); ?>' class='regular-text' />
    				<br />
    				<span class='description'>Please enter your Facebook username/alias. http://www.facebook.com/<strong>username</strong></span>
    			</td>
    		</tr>
    		<tr>
    			<th><label for='linkedin'>LinkedIn</label></th>
    			<td>
    				<input type='text' name='linkedin' id='linkedin' value='<?php echo esc_attr(get_the_author_meta('linkedin', $user->ID)); ?>' class='regular-text' />
    				<br />
    				<span class='description'>Please enter your LinkedIn username. http://www.linkedin.com/in/<strong>username</strong></span>
    			</td>
    		</tr>
    		<tr>
    			<th><label for='digg'>Digg</label></th>
    			<td>
    				<input type='text' name='digg' id='digg' value='<?php echo esc_attr(get_the_author_meta('digg', $user->ID)); ?>' class='regular-text' />
    				<br />
    				<span class='description'>Please enter your Digg username. http://digg.com/users/<strong>username</strong></span>
    			</td>
    		</tr>
    		<tr>
    			<th><label for='flickr'>Flickr</label></th>
    			<td>
    				<input type='text' name='flickr' id='flickr' value='<?php echo esc_attr(get_the_author_meta('flickr', $user->ID)); ?>' class='regular-text' />
    				<br />
    				<span class='description'>Please enter your flickr username. http://www.flickr.com/photos/<strong>username</strong>/</span>
    			</td>
    		</tr>
    	</table>
    <?php } ?>
    
  4. Create a new page and select “Authors List” from the page template dropdown menu

Usage Instructions

  • User must create at least one post to list on the page
  • Display Name is used on author listings
  • No user description means no avatar
  • Links to your social media profiles can be entered on the edit profile page. See:

How to customize

  • To display smaller or larger avatars, edit author.php and find:
    <?php echo get_avatar(get_the_author_meta('user_email', $author->post_author), 80); ?>

    Replace 80 which is width and height (80×80) of avatar with your desired size.

  • To add a different background color for a particular author, in your stylesheet use #author-username css selector to target a particular author.

    Lets say you want to change background color of “admin” listing to black and text color to white, you can use #author-admin { background-color: black; color: white; } css in your stylesheet.

Customization possibilities are endless. If you want help customizing your authors page, let me know in comments, I will respond with a solution.

Keep In Touch

Leave your suggestions and comments below, and don’t forget to subscribe to our RSS Feed and follow us on Twitter to stay updated.

69 Comments
  1. Thanks Haris!

    Maybe I’m missing something here but I don’t see anything about how to link to this page. Did I miss something?

    What I’d really like to have is an author’s “archive” page. For example, click on Author name/link in post (on a normal page of listed posted) and get a page with just that author’s posts. Kinda like by Category but by Author. Make sense? I’d then like to supplement that page template with something like you have above.

    Anything you can share with me on the above would be appropriated. I’m doing some poking around but can’t seem to land my searches inn the right spot that gives fills in some of the blanks I need.

    Thanks in advance.

  2. Are these links automatically filtered or can we put whatever we want in there? Like can I put in paragraph tags and stuff?

    I’m trying to figure out how to get around wordpress’s built-in description filter so I can have multiple paragraphs.

    • I couldn’t figure out how to stop wordpress from filtering out my html so I came up with another solution!

      When I output it on my authors.php I use some regex to replace [] codes with codes. So instead of doing a paragraph tag, I do a [p]. Then when it outputs my regex makes it regular html!

      Here’s what I did when calling:
      $des = get_the_author_meta(‘description’, $author->post_author); echo preg_replace(‘/\[([^\]]+)\]/’,”,$des);

  3. Now I just have a problem getting custom meta stuff to save. I wanted to add a checkbox so I did the following. http://pastebin.com/C74AjKaH

    The extra field shows up but when I change it and hit save it just reverts to being empty (unchecked). What am I missing?

  4. Great tutorial!

    I had a quick question. If I wanted to add content to my ‘Author’ page (e.g. images other than an avatar, how would I be able to do that for a single author page?

    Again, thanks for everything you do!

  5. Very cool. Any idea how to render the author info even if the author has not posted yet?

  6. hi, i’ve tried to use your files (great idea, i really needed it), created a page and used the template. now, i’ve two problems: the first is that the sidebar disappears, the second is that when i try to change the avatar size nothing happens. i get this error at the end of the page: Warning: require_once(/home2/meridid3/public_html/wp-content/themes/default/sidebar.php) [function.require-once]: failed to open stream: No such file or directory in /home2/meridid3/public_html/wp-includes/theme.php on line 996. Any help? Thanks. Paolo.

  7. Is there a way to make it so that not all authors show up on this page? I have had a few “guest” writers and I would prefer their bios not show up. I don’t want the admin to show up either.

    • I would also like to know this. I am thinking of excluding an author by user_id lets say.

    • Hey there guys, I know it’s a bit late and by now you probably already resolved this, but regardless, this is a trick I was taught over at the WP support forums (yeah, crazy, ppl actually answer to help requests there):

      $excluded = “1,33,4″; // To exclude IDs 1,33,4
      $authors = $wpdb->get_results(‘SELECT DISTINCT post_author FROM ‘.$wpdb->posts. ” WHERE ID NOT IN ($excluded)”);

      I think the code is self-explanatory (I got it and I’m a n00b), so I hope it helps!

    • If anyone is still struggling with how to remove specific authors from the list – this is the code you need:

      posts. ” WHERE post_author NOT IN ($excluded)”;
      $authors = $wpdb->get_results($sql);
      if($authors):
      foreach($authors as $author):
      ?>

      ~Remove the space from between the opening caret and the ?php — this form won’t allow code. Replace all tilted ‘ and ” with straight ones and it will work

    • If anyone is still trying to eliminate user id’s from this page – check out the solution here: http://wordpress.org/support/topic/filtering-information-with-get_results

  8. Hey Haris,

    Quick question. I’m not smart. How do I display all of an author’s post (multi-author blog) in author.php? Not sure what I have to change? Thanks much! Here is what my author.php looks like.

    Posts by nickname; ?>:

    <a href="” rel=”bookmark” title=”Permanent Link: “>

    ,

  9. This is very good idea, thank you so much!

    But I would like to do something else as well, I just thought about it but I have no idea how I will do it ;)

    I want to add the author box like the one under each post of an author to the to of author page, so each author will have his bio on the top of his author page!

    Any thoughts?

  10. Thanks for this! Just what I needed and works perfectly for the context I have it in.

    One question: is there a way to paginate this so only 10 authors show per page?

  11. Hi there Haris,

    First of all thanks for this post… I really like it.

    But I do have a question.
    How can I put the custom fields in my single author.php? (e.g. Facebook field).

  12. Back again :) Couple things:

    1) http://codex.wordpress.org/Author_Templates

    2) Does anyone know of a good plugin for author bios? What I’d like to do is have each author page lead in with an introduction / bio box. Any thoughts?

  13. Hi, thanks a lot for this ! I applied it to my webzine.

    Some questions, thought :

    Is it possible to exclude admin & contributors? Some of my authors have quit the team and I want to show only the current ones.

    Is it possible to classify the authors? The list seems to show them randomly !

    Thank you !

  14. How do I modify the query to match my permalink structure of year/month?

  15. Hello,
    I’m a french user of this wordpress Hack, excuse me for my bad english, but i want to thank you for this really usefull Hack !

    I’ve only one problem with this hack, the authors are not display by name order (only by id order) and it’s not really simple when you have a lots of authors in your blog. Mylène, i think this comment can help you !

    If you want to order by name just change this line in Authors.php:
    $authors = $wpdb->get_results(‘SELECT DISTINCT post_author FROM ‘.$wpdb->posts);

    by this line:
    $authors = $wpdb->get_results(‘SELECT DISTINCT post_author FROM ‘.$wpdb->posts.’ JOIN wp_usermeta ON user_id = post_author WHERE meta_key=\’last_name\’ ORDER BY meta_value’);

    I’m not sure this is the best method but it works !

    Have a nice day.

  16. How do I insert _blank on fuction twitter, facebook, etc?

    thank you

  17. Hello,

    I am setting up an Contributors page using your authors template. It seems to be working fine but will need some tweaks to the formatting. Here is the link:
    http://www.allhabs.net/contributors-2/
    I would like it to be center-justified, and have a top margin to fit my template. Also the background shouldn’t be transparent.
    I’m not sure where to find these settings. I’m new to this, can you please help. Thanks.

  18. hello harris, I’m trying to use this article for my author.php page (author profile pages). I’m almost done but I’m just getting stuck at one point. I’m pretty sure, I need to create a query so that it pulls social networking links of only that author which I’m looking at. instead, it just pulls up social networking of the last author who joined.
    pleaseeeeeeeeeeeee haris, help. only you can help, please please please help. thank you for the help :)

  19. Hi,

    I just implemented your plugin on my site it works great. But there is problem now when ever I click on Home like its getting redirected you authors-list page instead of default Home page. How to rectify it.

    I tried deleting the files and reverting the functions.php but nothing to avail. Your help is highly appreciated.

    Regards,

    Mohan

  20. HUGE HELP!!!

    I’ve been looking all evening for this solution, and though it’s not perfectly styled, it is a perfect solution, so thanks much.

  21. Hi,

    Thanks for this post! I have a question that I cannot seem to find an answer to…

    I have multiple user on my website who used to be authors, but no longer are. I have changed their role in the backend to subscriber, but they are still displayed on the author’s page.

    How can I filter the Author’s page to show only users with the role of author or greater?

    Thanks!

    —————————-

    There doesn’t seem to be a way to receive an email notification when new comments are posted, could you send me an email? http://chiefscommand.com/about-chiefs-command/contact-chiefs-command/

  22. Hey guys!
    Thanks very much for making this extension!
    It looks great on my website, except for one minor issue, which I can’t seem to fix. The side bar is out of alignment with the authors fields.
    Here is the page in question: http://pau.lu/squishenglish/?page_id=567

    Any help would be greatly appreciated!

    Thanks again

    Paul

  23. Got this error with wp 3.0.1

    Warning: Cannot modify header information – headers already sent by (output started at /home/content/93/6742993/html/wp-content/themes/mytheme/functions.php:69) in /home/content/93/6742993/html/wp-includes/pluggable.php on line 890

  24. Hi there,

    >> how do i hide the authors who have have written no posts?

    thanks, great plugin btw.

    Jim C

  25. Hi

    Page worked fine but collided with my theme, scroll to the bottom of this page to see how.

    http://insidegossip.co.uk/our-writers/about-our-writers/

    Please advise on how i can fix the problem

    thanks

  26. Hi! I’m curious about how to change the order of the authors being listed. How would I go about doing that?

    • Ann,
      I was able to sort the order by display_name ascending by using the following:

      $authors = $wpdb->get_results(‘SELECT DISTINCT post_author
      FROM ‘.$wpdb->posts.’
      JOIN wp_usermeta ON user_id = post_author
      WHERE meta_key=\’nickname\’
      AND meta_value!=\’admin\’
      ORDER BY meta_value ASC’);

      This code also does not include the ‘admin’ user in the list. I am still trying to figure out how to prevent the contributors with blank descriptions from appearing.

  27. Thanks for the excellent info. We’ve been looking at doing something like this for a while now. You can view our version here: http://www.bloodsprayer.com/authors/

  28. Nice tutorial. In my opinion a WP theme isn’t complete without the author pages and author bio section on posts. GJ & thanks for the tut.

  29. http://edreach.us/contributors/

    I implemented your page, but I have not pasted in the social code. When I did, I got an error saying that the Header could not be modified. I assume that because I’m using a custom template that I’m getting a conflict.

    Here’s what I’m seeing in my functions.php :

    Is there anything you recommend me doing to make this work? I’m pretty happy with this solution, and would love for it to work.

    -Daniel

  30. I also got this error:

    Warning: Cannot modify header information – headers already sent by (output started at /home/content/93/6742993/html/wp-content/themes/mytheme/functions.php:69) in /home/content/93/6742993/html/wp-includes/pluggable.php on line 890

    Can you help with this?

    Daniel

  31. This has been very helpful, however I am trying to figure out how to not display authors that don’t haven’t filled out their description section on the site.

    Any ideas what the best way to do this would be?

  32. Hi Haris,

    I couldn’t find a contact link on your site so I’ll ask you here:

    I’m creating a Wordpress theme that I am going to sell online. Do you mind if I use the code from this post in my theme? If not, please let me know.

    Thanks,
    Brian

    P.S. Great job – the code is awesome :)

  33. I’m having trouble figuring out how to re-order the authors by name, alphabetically. I’m sure it’s something simple… but not seeing how. Help?

    Awesome article! It has helped a bunch :)

  34. Is there a way to exclude recent posts by category ID in this?

  35. hi thanks of the post

    i have to link avatar in post page

    how can i do that.

    when call the_author or it return link with text i need only link which i can place on author avatar

    any help appreciated

    many thanks

  36. Is it possible to display more than one recent post, e.g. the last 10?

  37. Doesn’t seem to work with WP 3.x and ARRAS theme… once I update my profile I get this error –

    Warning: Cannot modify header information – headers already sent by (output started at /home/neverme1/public_html/wp-content/themes/arras/functions.php:70) in /home/public_html/wp-includes/pluggable.php on line 934

  38. I’d like to set up a site where the officers of the Business Courses Club could post on the blog, using different log-in information. Can someone tell me how to do that please?

  39. Hi!

    We used your script in our blog and it helped a lot… thks!!!

    There are only two things that we need to do and don’t know how:

    Hide some of the authors;

    List authors by importance, for ex. Founders first and then by number of posts done.

    Are these things possible?

  40. I know this article is a year old, but it’s been an awesome help to me and I’m really happy with how my authors page is working out. I have two questions that have been mentioned prior but I’d like to ask if there has been anyone to solve them?

    - Is there a way to show users that have 0 posts? In my case, the “authors” page is used as a “team” page where not necessarily everyone will be posting, but I would like to include them.

    - Is there a way to change the order of the users on the page? (Or elsewhere that would affect the page?)

    Thanks!

    • Ah, I figured out one of my own questions right after posting!

      To have a user show up if they only have 0 posts, just create a draft under their name. Lame workaround if you have a lot of user, but it’s fine for me. The post does not appear on the blog, but they have technically written one.

  41. Excellent code, it’s exactly what I was looking for, thanks a lot Haris!

  42. Hi all,

    I have a profile page and I need to make a comment system on it. The comments system should work exactly the same way as standard WordPress comment system, but instead of posts it should work with users. For better understanding, I have 1 page which acts as a profile for every user (user_login is in the URL) and at the bottom of that page users can leave comments about ‘profile’ user. and

    Any ideas how to achieve this? What should be changed? Is there any wordpress plugin for this of can you send me any PHP function for this.

    waiting….

    Thanks

  43. Ahhh, great share. Very smart! Thanks :)

  44. perhaps not the correct way to do it but this works for now.

    #author-jessieannekeller {display: none}

  45. I need to know how to hide ID=1 too.
    Great work with the Tutorial
    Thank you very much!

  46. Thanks for this kick ass code. Here it is: http://cycleandstyle.com/contributors/

    Still wish I could figure out how to exclude user id’s.

    Thanks a bunch.

  1. links for 2010-04-10 « Free Open Source Directory
  2. WordPress Authors Page — IT-erate Services, LLC
Leave a Reply