Hi all – I was wondering if one of you can help us find a solution to a feature we would like to add to a WordPress site:

The site in question has multiple contributors. Most are dedicated to certain categories. We would like to automatically display on a category page only the authors who have written articles in that particular category.

For example, let’s say we have a category called “Cucumbers” and a category called “Tomatoes.” When someone clicks on the Cucumbers category we would like only the authors who have written posts categorized as Cucumber posts to appear, and on the Tomatoes category page, we would like only the authors who have written Tomato category posts to appear. There may be some overlap between the pages, since some authors may write posts for both the Cucumber and the Tomato categories.

One solution we thought of is to call the category we want and the number of posts from that category and then display the list of authors. The problem is it shows duplicate authors. Here’s the code:

<?php query_posts('showposts=20&cat=3'); ?>
<?php while (have_posts()) : the_post(); ?>

<?php the_author_posts_link (); ?>

<div style="clear:both"></div>
<?php endwhile;?>

Is there a way to prevent duplicate authors from appearing? Or is there a better way?

Thanks in advance for your help.