Add multiple authors and guest authors for WordPress posts

By default, WordPress assigns a single author to each post. Multiple authors are not possible. With the Co-Authors Plus plugin, additional authors can be added for WordPress articles and displayed in the theme.

The WordPress plugin is particularly suitable for larger, editorially operated news portals as well as for smaller blogs, which often work with guest authors.

The implementation of the plugin in the frontend is a bit difficult because the existing theme has to be expanded with the template tags of the plugin. Unfortunately, due to the differences in the respective theme, there is no general solution.

This tutorial shows the implementation with TwentySeventeen as an example.

Co-Authors Plus

The plug-in is installed on 20,000 websites and has somewhat mixed ratings, which is mainly due to minor bugs in previous versions and the complicated implementation for non-programmers.

With the last update from two weeks ago (April 2017) some bugs for WordPress 4.7 were fixed. In my tests, the plugin worked smoothly with the current WordPress version.

Assign multiple bylines to posts, pages, and custom post types via a search-as-you-type input box

By: Mohammad Jangda, Daniel Bachhuber, Automattic

( 63 )
Last updated: 9 months ago
30,000+ active installations
Compatible up to: 5.3.6

Add new authors with WordPress account

If no separate accounts with login exist for the additional authors, new users can be created at any time in the WordPress admin area under Users → Add new. Below I also show the possibility of creating guest authors without their own account.

Authors can log in themselves with their own WordPress account, which is particularly useful for regular authors. Depending on the user role, the user can then edit and publish posts.

The rights of the user roles in brief:

  • Employee: Can make his own contributions, but not publish himself
  • Author: Can edit and publish his own contributions
  • Editor: Can edit and publish his own and third-party contributions

In order to later show the WordPress user as another author in the post, at least the role of employee is required. Users with the role of Subscriber cannot be added as authors because they do not have the necessary rights.

Assign multiple authors in the post

The plugin replaces the standard box for selecting the author with a new box for authors , with which several authors can be added at once. The new box is now available in the sidebar or under the editor when creating or editing a post.

To add another author, you can search for his or her account in the WordPress installation. The plugin can find the right user based on their username, first and last name or email address.

The order of the authors can also be easily changed using drag & drop. Additional authors can be removed again, but each contribution must have at least one author assigned.

Add guest authors

If you only want to publish guest posts by foreign authors on an irregular basis, but generally operate a blog as the sole author, you will rarely want to create new user accounts for each guest author.

For this, the plugin offers the option of creating additional authors for guest posts under Users → Guest authors. The guest authors do not receive their own WordPress account and therefore cannot log in themselves to create and edit posts.

In addition to normal WordPress users, the guest authors can also be selected in the author box.

In the front end, the difference between a guest author and the correct account with login is not visible. There is also an archive page for guest authors with all of the author's contributions.

Show authors in the theme

Since each theme shows the author of the post in different places and with different functions, there are no general hooks with which the Co-Authors Plus plugin can display the authors.

For this reason, the additional authors are not automatically displayed in the theme after they have been added in the admin area. This is not a bug in the plugin.

The plugin provides three different template functions with which the authors can be displayed in the theme:

  • coauthors () - Shows authors without hyperlinks
  • coauthors_posts_links () - Shows authors with link to author archive
  • coauthors_links () - Shows authors with a link to their website

The functions can be built into a suitable template file for the theme. To do this, the template file should be overwritten with a child theme .

It is important to check the availability of the plugin with a function_exists () query.

 if ( function_exists( 'coauthors_posts_links' ) ) { coauthors_posts_links(); } else { the_author_posts_link(); }

This ensures that there will be no errors if the plugin has been deactivated.

Extend existing template functions (example TwentySeventeen)

Most themes will already show the author of the post in the theme. Mostly own template functions are used here, which can be found by browsing through the theme files. Often found in /inc/template-tags.php .

Often these functions are pluggable , ie they can be overridden in a child theme. Pluggable functions can be recognized by an if query with function_exists (), which includes the function.

In the new standard theme TwentySeventeen, the date and the author of the post are displayed with the twentyseventeen_posted_on () function. This function can be copied into the functions.php of the child theme and then extended with the template functions of the Co-Author Plus plugin.

 function twentyseventeen_posted_on() { // Show multiple authors if Co-Authors plugin activated. if ( function_exists( 'coauthors_posts_links' ) ) { $byline = sprintf( /* translators: %s: post author */ __( 'by %s', 'twentyseventeen' ), coauthors_posts_links( ', ', ' und ', null, null, false ) ); } else { // Get the author name; wrap it in a link. $byline = sprintf( /* translators: %s: post author */ __( 'by %s', 'twentyseventeen' ), '<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . get_the_author() . '</a></span>' ); } // Finally, let's write all of this to the page. echo '<span class="posted-on">' . twentyseventeen_time_link() . '</span><span class="byline"> ' . $byline . '</span>'; }

If the plugin is activated, the function coauthors_posts_links () is used to display the authors.

The result:

Conclusion

The Co-Authors Plus plugin is an easy-to-use plugin to display guest authors or multiple authors in WordPress posts.

The implementation of the plugin in the WordPress theme, however, requires experience in WordPress theme development and often cannot be done by users alone. For beginners, we recommend that you ask the developer of the theme or hire a freelancer.