I have this coding challenge that's beating my head
I built a site for an academic magazine, where some of the articles are written by two or more authors. This was easily acheived using either Co-Author or Co-Author Plus plugin, as shown in the following image.
Then, using this code, I built an authors archive where I display all wordpress authors with posts published.
<?php
$authors = $wpdb->get_results('SELECT DISTINCT post_author FROM '.$wpdb->posts.' JOIN wp_usermeta ON user_id = post_author WHERE meta_key=\'last_name\' ORDER BY meta_value');
if($authors):
foreach($authors as $author):
?>
<div class="author" id="author-<?php the_author_meta('user_login', $author->post_author); ?>">
<?php if(get_the_author_meta('description', $author->post_author)): ?>
<div class="description">
<h3><a href="<?php bloginfo('url'); ?>/author/<?php the_author_meta('user_nicename', $author->post_author); ?>"><?php the_author_meta('last_name', $author->post_author); ?>, <?php the_author_meta('first_name', $author->post_author); ?></a></h3>
<p><?php the_author_meta('description', $author->post_author); ?></p>
</div>
<?php else : ?>
<!-- <div class="description">
<p>No description in the author's profile.</p>
</div> -->
<?php endif; ?>
</div>
<?php endforeach; endif; ?>
But the code only displays "first" authors. i.e the first author assigned to a post, and not the second nor third. So, if the second or third author hasn't published another different post by himself, he won't appear on the authors list.
So, the question is, how can I modify this code to show all authors associated with a post? Maybe a string where author_has_post >= 0, and then how to prevent the admin author from appearing on the list