This article was originally published in January 2011.
I rewrote the article in November 2012 to take advantage of new features developed since then.
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.
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
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:
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:
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.