Hi wonder if someone can help with this.
I have spent most of today trying to solve this but can't so I hope someone here can help.
I have created a custom page to show details of contributors and authors using code that I found here, but when I show the page it shows a list of all registered users, no matter what their role is.
Does anyone know how I can modify this code to just show contributors, authors and select admins. I know the answer is in the SQL query but my PHP and SQL aren't that great!
function contributors() {
global $wpdb;
$authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users WHERE display_name <> 'admin' ORDER BY display_name");
foreach ($authors as $author ) {
echo "
echo '<div>';
echo get_avatar($author->ID);
echo "</div>";
echo '<div>';
echo "";
echo the_author_meta('display_name', $author->ID);
echo "";
echo "
";echo "
";
echo the_author_meta('user_description', $author->ID);
echo "
";
echo "</div>";
echo "
echo "
";
}
}
Thanks in advance.