Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

List of Author Boxes WordPress



I want to have a page with a list of all the authors of the website. Instead of having just a list I want to have:

Image of the author (I'm using User Photo plugin not avatars)
Name of the author
Description of the author
Link to the author's archive of text

I don't want to list either the admin nor the contributors, just the authors.

I found this code, but I coulnd't make it work:


Answers (2)


Dan Fraticiu answers:

Put this into your function.php

function authors_list_shortcode_handler($atts, $content=null){

global $wpdb;

$authors = $wpdb->get_results( "SELECT ID, user_nicename from $wpdb->users ORDER BY display_name" );

$content = '';
foreach($authors as $author){

$content .='<div id="colaborador">';

$content .= userphoto($author->ID);
$content .= '<div id="titulocolaborador">'.get_usermeta($author->ID, 'first_name').' '.get_usermeta($author->ID, 'last_name').'</div>';

$content .= '<div id="textocolaborador">'.get_usermeta($author->ID, 'description').'</div>';

$content .= '<a href="'.get_author_posts_url($author->ID, $author->user_nicename).'">Link</a>';

$content .= '</div>';

return $content;


Then use this [authors_list] where you wnat to display the list.

I'm don't know if the photo will work, I haven't test it as I don't have that plugin installed but everything else shold be fine.

Olivia comments:

Hi Dan,

Thanks for answering.
This is giving error:

Everything else work great
I'm using the plugin because some of the writers prefer to email their picture to me than to create their avatar by themselves. Can you think in how to solve this?

Dan Fraticiu comments:

I've updated the code, and I tested it. You should have no more problems.

Olivia comments:

Thanks Dan,

It works perfectly!


Nathaniel Usarzewicz answers:

So, in function.php copy/paste this code:

function my_list_authors() {
global $wpdb;

$authors = $wpdb->get_results("SELECT * from $wpdb->usermeta WHERE meta_key = 'wp_capabilities' AND meta_value = 'a:1:{s:6:\"author\";b:1;}'");

foreach ( (array) $authors as $author ) {
$author = get_userdata( $author->user_id );
$userlevel = $author->wp2_user_level;

$name = "$author->first_name $author->last_name";
$the_description = $author->description;
$author_id = $author->ID;

$file = get_option('home') . '/';
$the_link .= $file . '?author=' . $author_id;

?><li><?php echo '<a href="' . $the_link . '" title="' . $name . '">';?><?php echo userphoto($author_id, '', '', array(style => 'width:100px;height:100px;'), get_template_directory_uri() . '/default-avatar.gif'); ?><br /><span class="authors_displayname"><?php echo $name; ?></span></a><br /><?php echo $the_description; ?></li>

Then create page template ([[LINK href=""]]how-to on Codex[[/LINK]]) and within WordPress loop paste this function:

<?php my_list_authors(); ?>

This will display all authors (people with author rank) from your WordPress with userphoto, name, description and it will all be wrapped into link to author's archive, and it will also display default avatar from your template folder :)

Olivia comments:

Hi Nathaniel,
Thanks for your response.
I can't make your code work.
The page is blank:

Nathaniel Usarzewicz comments:

Then try this, find:


and change to:


If this doesn't work, please take a look at your database -search usermeta table, look for wp_capabilities like this a:1:{s:6:\"author\";b:1;} - that 'author' part is what really matters, when you find it, copy and paste into the code as I said (replace a:1:{s:6:\"author\";b:1;}) with it, and it should work.

Olivia comments:

Thanks for your help Nathaniel,
I'll have you in my mind next time that I need some help.