I am trying to list all of the authors in my wordpress blog that have published posts, excluding the admin. The below works for excluding the admin but when I add "AND post_count > 0" to only show authors with posts it doesn't display anything. Is there a way to modify this code to only show authors with posts?
Code:
function contributors() {
global $wpdb;
$authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users WHERE display_name <> 'admin' AND post_count > 0 ORDER BY display_name");
foreach ($authors as $author ) {
echo "<li>";
echo "<a href=\"".get_bloginfo('url')."/author/";
the_author_meta('user_nicename', $author->ID);
echo "/\">";
echo get_avatar($author->ID, 12);
echo "</a>";
echo "<a href=\"".get_bloginfo('url')."/author/";
the_author_meta('user_nicename', $author->ID);
echo "/\">";
the_author_meta('display_name', $author->ID);
echo "</a>";
echo "</li>";
}
}