我只能按单个角色列出用户。当我尝试在下面的代码中添加一个数组时,我只会得到一个所有作者的列表。我肯定我错过了一些直接的东西。
谢谢
乔希
<?php
$roles = array(\'guest-teacher\', \'president\', \'core-faculty\');
$args = array(
\'meta_key\' => \'last_name\',
\'role\' => $roles
);
$wp_user_query = new WP_User_Query($args);
$wp_user_query->query_orderby = str_replace( \'user_login\', \'lsjs_usermeta.meta_value\', $wp_user_query->query_orderby );
$wp_user_query->query();
$authors = $wp_user_query->get_results();
// Check for results;
if (!empty($authors))
{
echo \'<ul class="permanent">\';
// loop trough each author
foreach ($authors as $author)
{
// get all the user\'s data
$author_info = get_userdata($author->ID);
$url = get_author_posts_url($author->ID);
?>
<h3><a href="<?php echo $url; ?>"><?php echo $author_info->last_name; ?></a></h3>
<?php
}
echo \'</ul>\';
} else {
}
?>