If you have a lot of authors on your blog, you might want to display a list of all of the authors on your About page or in your website’s sidebar. You can easily do that using the wp_list_authors function. It’s really simple and outputs a list of all authors.

Add this code in your theme where you want to display a list of all authors:

<div class='author-list'>
	<h2>All Authors</h2>
	<ul>
		<?php
		echo wp_list_authors(array(
			// Exclude admins from the list.
			'exclude_admin' => false,
			
			// Display the number of posts by this author in parenthesis.
			'option_count' => false,
			
			// Show the author's full name. By default, only the nickname is displayed.
			'show_fullname' => true,
			
			// Hide authors who don't have any published posts.
			'hide_empty' => false,
		));
		?>
	</ul>
</div>

The above code will display an unordered list of all authors on your blog. It will display their full names. It will exclude authors who don’t have any published posts.

If you want to hide admins, make ‘exclude_admin’ true:

echo wp_list_authors(array(
	// Exclude admins from the list.
	'exclude_admin' => true,
	
	// Display the number of posts by this author in parenthesis.
	'option_count' => false,
	
	// Show the author's full name. By default, only the nickname is displayed.
	'show_fullname' => true,
	
	// Hide authors who don't have any published posts.
	'hide_empty' => false,
));

If you want to display the number of posts the author has published, you can enable the ‘option_count’ argument:

echo wp_list_authors(array(
	// Exclude admins from the list.
	'exclude_admin' => true,
	
	// Display the number of posts by this author in parenthesis.
	'option_count' => true,
	
	// Show the author's full name. By default, only the nickname is displayed.
	'show_fullname' => true,
	
	// Hide authors who don't have any published posts.
	'hide_empty' => false,
));

Pin It on Pinterest

Share This