It’s not all that uncommon for there to be more than one author on a WordPress site and the following gives you the basics to share the wealth among the published authors.

The following is actually quite basic in what it displays but can easily be adapted to be more of a display element than if it was simply dropped into the a template as is.

We’ll just jump right into the code this time and then cover what we’re doing afterward:

To see the code click here.To hide the code click here.

function share_the_author_wealth( $echo = true ) {

   $author_args = array(
      // 'optioncount'   => false,
      'optioncount'   => true,
      // 'show_fullname' => false,
      'show_fullname' => true,
      // 'echo'          => true,
      'echo'          => false,
   );

   if ( is_multi_author() ) {
      $output = wp_list_authors( $author_args );
   } else {
      $output = null;
   }

   /** @var string $output - wrapped in ul element */
   $output = '<ul class="authors-list">' . $output . '</ul><!-- authors-list -->';

   /** @var string $output - last chance to change content with a hook */
   $output = apply_filters( 'wpfa_authors_list', $output );

   if ( true == $echo ) {
      echo $output;
   } else {
      return $output;
   }

   return null;

}

To start, by default, the function will display the authors list to the page. Within the function, you will see the $author_args simply contains what is changed from he wp_list_authors parameters (feel free to set this how you wish).

Since the wp_list_authors function produces an unordered list by default it’s probably going to be best to wrap the output in the appropriate HTML unordered list tag (ul).

It never hurts to offer up a hook to replace the function’s output so that’s next and then the function’s only parameter is checked to see if the output should be rendered to the screen with an echo statement or just returned for other uses.

This is more or less drop-in code. It can be added to most any template or quickly extended to a widget with options for the wp_list_authors parameters.

How would you use something like this?