so close to figuring this out, or not I’m not to sure! Basically what I want to do is on the authors page (so outside the loop) if a user role is an editor I want to display a little badge (but just outputting their name and role at the mo) in their profile. I have:
functions.php:
function get_user_role($id)
{
$user = new WP_User($id);
return array_shift($user->roles);
}
and
author.php:
<?php
global $post;
$aid = $post->post_author;
if ($userlevel == '2') {
echo get_the_author_meta('user_nicename', $aid).' | '.get_user_role($aid);
}
?>
But doesn’t seem to work, any ideas?
In your template:
Edit: Get all the editors first and then loop over them.
Does this help?