custom user order
-
https://www.knowingimmigrationlaw.com/contributors/
The client has requested a custom order to the list of contributors. Not alpha-numeric like originally used. This is what I’ve done:
Installed the Advanced Custom Fields Plugin by Elliot Condon and created a field that is named “rank”. It is a dropdown list with the numbers 1-8. It is only assigned to users that equal “author” with no default value.
Then, I assigned each user the ranking they were requested. Lastly, in my template file I used the following code:
<?php $allUsers = get_users('meta_key=rank&order=DESC'); $users = array(); // Remove subscribers from the list as they won't write any articles foreach($allUsers as $currentUser) { if(!in_array( 'subscriber', $currentUser->roles )) { $users[] = $currentUser; } } ?>
On my local testing machine, this works perfectly. On the server I uploaded it to, I get a random listing which is being shown.
Any help would be appreciated. Thanks.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘custom user order’ is closed to new replies.