I am currently listing all the users except users with administrator role on custom page template with:
<?php
$allUsers = get_users('orderby=post_count&order=DESC');
$users = array();
foreach($allUsers as $currentUser)
{
if(!in_array( 'administrator', $currentUser->roles ))
{
$users[] = $currentUser;
}
}
?>
In the following format:
<?php foreach($users as $user) { ?>
<div class="profile">
<div class="avatar">
<?php echo get_avatar( $user->user_email, '150' ); ?>
</div>
<div class="profileInfo">
<h2 class="name"><?php echo $user->display_name; ?></h2>
<p class="descrption"><?php echo get_user_meta($user->ID, 'description', true); ?></p>
</div>
<div class="clear"></div>
</div>
<?php } ?>
As I am going to add 6 more custom user group (role) so I would like to list users from specific role instead of listing all the users except administrator role.
I have already tried several tutorial but for reason I am not able to incorporate with my current listing code.