Codex

Template Tags/wp list authors

Contents

Description

Displays a list of the blog's authors (users), and if the user has authored any posts, the author name is displayed as a link to their posts. Optionally this tag displays each author's post count and RSS feed link.

Usage

 <?php wp_list_authors$args ); ?> 

Default Usage

 <?php $args = array(
    
'optioncount'   => false
    
'exclude_admin' => true
    
'show_fullname' => false,
    
'hide_empty'    => true,
    
'echo'          => true,
    
'feed'          => 
    
'feed_image'    => 
,
    
'style'         => list,
    
'html'          =>  ); ?> 

By default, the usage shows:

  • Does not display the count of the number of posts
  • Excludes the 'admin' author from the list
  • Displays the author "Display name publicly as"
  • Excludes users with no posts
  • Display the results
  • No author feed text is displayed
  • No author feed image is displayed
  • The style is in list format
  • Items are returned with valid HTML

Parameters

optioncount 
(boolean) Display number of published posts by each author. Options are:
  • 1 (true)
  • 0 (false) - default
exclude_admin 
(boolean) Exclude the 'admin' (login is admin) account from authors list. Options are:
  • 1 (true) - default
  • 0 (false)
show_fullname 
(boolean) Display the full (first and last) name of the authors. If false, the "Display name publicly as" is displayed. Options are:
  • 1 (true)
  • 0 (false) - default
hide_empty 
(boolean) Do not display authors with 0 posts. Options are:
  • 1 (true) - default
  • 0 (false)
echo 
(boolean) Display the results. Options are:
  • 1 (true) - default
  • 0 (false)
feed 
(string) Text to display for a link to each author's RSS feed. Default is no text, and no feed displayed.
feed_image 
(string) Path/filename for a graphic. This acts as a link to each author's RSS feed, and overrides the feed parameter.
style 
(string) Style in which to display the author list. A value of list, the default, displays the authors as an unordered list, while none generates no special display method (the list items are separated by comma). If html is false, this option is ignored. This option was added with Version 2.8. Valid values:
  • list - default.
  • none
html 
(boolean) Whether to list the items in html or plaintext. The default setting is true. If html is false, the style setting is ignored and the items are returned, separated by comma. This option was added with Version 2.8. Valid values:
  • 1 (true) - default
  • 0 (false)

Examples

Authors Full Names and Number of Posts

This example displays a list of the site's authors with the full name (first and last name) plus the number of posts for each author. Also, and by default, it excludes the admin author, hides authors with no posts, and does not display the RSS feed or image.

<?php wp_list_authors('show_fullname=1&optioncount=1'); ?>

Harriett Smith (42)

Sally Smith (29)

Andrew Anderson (48)

Change Log

  • Since: 1.2.0
  • 2.8.0 : Added the style parameter.
  • 2.8.0 : Added the html parameter.

Source File

wp_list_authors() is located in wp-includes/author-template.php.

Related

the_author, the_author_link, the_author_posts, the_author_posts_link, wp_list_authors, wp_dropdown_users, the_author_meta

wp_list_authors, wp_list_categories, wp_list_pages, wp_list_bookmarks, wp_list_comments, wp_get_archives, wp_page_menu, wp_dropdown_pages, wp_dropdown_categories, wp_dropdown_users

See also index of Function Reference and index of Template Tags.