List your authors
show your website’s authors and a link to their post archives. Cool feature if your site is a multi-author blog.
/** * Snippet Name: List your authors * Snippet URL: https://wpcustoms.net/snippets/list-authors/ */ // usage: echo wpc_list_authors(); function wpc_list_authors() { $authors = get_users(array( 'orderby' => 'display_name', 'count_totals' => false, 'who' => 'authors' // change to different userrole if required ) ); $list = ''; if($authors) : $list .= '
- ';
foreach($authors as $author) :
$list .= '
- ';
$archive_url = get_author_posts_url($author->ID);
$list .= get_avatar($author->user_email, 60);
$list .= '' . $author->display_name . '';
$list .= '
' . get_user_meta($author->ID, 'description', true) . '
'; $list .= ''; $list .= ' ';
endforeach;
$list .= '