Currently I'm trying to create a author list with all authors but on top some 'special' authors. The 'special' authors should result first and shouldn't be available in the list with normal authors.
The 'special' authors have in usermeta a meta key called 'werksortgodmodus' with meta value 'yes'. The 'rest' of the authors have 'werksortgodmodus' = no .
The result should be something like this:
[author with godmodus], [author with godmodus], [author with godmodus], [normal author], [normal author], [normal author].
This is the code I found and stripped to get authors. How can I get authors with godmodus on top?
[edit] replaced code with original code [/edit]
<?php
$display_admins = false;
$order_by = 'display_name';
$role = 'author';
$avatar_size = 64;
if(!empty($display_admins)) {
$blogusers = get_users('orderby='.$order_by.'&role='.$role);
} else {
$admins = get_users('role=administrator');
$exclude = array();
foreach($admins as $ad) {
$exclude[] = $ad->ID;
}
$exclude = implode(',', $exclude);
$blogusers = get_users('exclude='.$exclude.'&orderby='.$order_by.'&role='.$role);
}
$authors = array();
foreach ($blogusers as $bloguser) {
$user = get_userdata($bloguser->ID);
if(!empty($hide_empty)) {
$numposts = count_user_posts($user->ID);
if($numposts < 1) continue;
}
$authors[] = (array) $user;
}
echo '<ul class="contributors">';
foreach($authors as $author) {
$display_name = $author['display_name'];
$description = get_userdata($author['ID'])->user_description;
$avatar = get_avatar($author['ID'], $avatar_size);
$author_profile_url = get_author_posts_url($author['ID']);
echo '<li><h3>'.$display_name.'</h3><a href="', $author_profile_url, '">', $avatar , '</a><p>'.$description.'</p><p><a href="', $author_profile_url, '" class="contributor-link">➤ Posts by '.$display_name.'</a></p></li>';
}
echo '</ul>';
?>