Multiple Authors for a Post

If you have a magazine-like website, you might need to specify multiple authors for a single post.

This article was originally published in January 2011.
I rewrote the article in November 2012 to take advantage of new features developed since then.
David Gray wrote a follow-up article in September 2014 which you might also want to review.

If you have a magazine-like website, you might need to specify multiple authors for a single post. There's a great plugin called Co-Authors Plus that will let you do this.

Once installed, you can use many template tags , or you can use the get_coauthors() function to retrieve all the author data and use it however you like.

Authors Shortcode

The Post Info area of Genesis can be customized using a filter . We could drop the coauthors_posts_links() function in there to list authors and link to their archive pages, but it would be even better to create a shortcode to be used in the post info section. If that function isn't available (ex: someone disabled the plugin), it will use the standard get_author_posts_url() instead.

We will create a shortcode called [post_authors_post_link] with the following parameters:

  • between - what to display between authors, default is a comma
  • between_last - what to display between the last two authors, default is "and"
  • before - what to display before the list of authors, default is empty
  • after - what to display after the list of authors, default is empty

To set up the shortcode, add the following to your functions.php file or core functionality plugin :

[gist id="4061770"]

Now if we want to update the Genesis Post Info to display all post authors (with "by" right before the listing), we'd add this to functions.php:

[gist id="4061836"]

Author Boxes

Genesis also has a feature called the Author Box that displays the author information at the bottom of the post. But this doesn't use Co-Authors Plus, so if you have multiple authors only one will show up at the bottom.

First we'll remove the Genesis Author Box. Then we'll copy the code into our own function, but this one will accept an author ID field so we can render any author with it. Finally, we'll create a function that checks to see if Co-Authors Plus is in use, and if it is, display author boxes for all authors; if it isn't, display the author box for the normal post author.

[gist id="4061869"]

No comments yet