Hi Guys,
I have created a authors page where I list all the authors in the site. Unfortunately, not all the registered users have written something yet. What I want to do is, hide the authors with no posts. Here is the code I use that shows all the authors.
Help :)
<?php global $wpdb;
$query = "SELECT ID, user_nicename from $wpdb->users ORDER BY user_nicename";
$author_ids = $wpdb->get_results($query);
foreach($author_ids as $author) :
$curauth = get_userdata($author->ID);
if($curauth->user_level > 0 || $curauth->user_login == 'admin') :
$user_link = get_author_posts_url($curauth->ID);
?>
<div class="box-left box-author clearfix">
<a href="<?php echo $user_link; ?>" title="<?php echo $curauth->display_name; ?>">
<?php echo get_avatar($curauth->user_email, '100'); ?>
</a>
<h3><a href="<?php echo $user_link; ?>" title="<?php echo $curauth->display_name; ?>">
<?php echo $curauth->display_name; ?></a></h3>
<p><?php echo $curauth->description; ?></p>
</div>
[moderated--bumps removed. Please refrain from bumping as per Forum Rules]