Okay - gonna try and ask a question again...
I'm trying to make a list of authors show up in my sidebar. Basically in the main content there will be a list of posts. In the sidebar, I want a duplicate loop but ONLY with the list of author names whose posts are displayed on that particular listing page.
For example, say you have (in your settings) to display 5 posts per listing page. For example, say these 5 posts were written (in order) by admin, Richard, Richard, Mark and admin. In the sidebar, I put in a function that basically did a second loop, but had only the author names listed. However, it's listing the names multiple times, not just once:
admin
Richard
Richard
Mark
admin
What I want is :
admin
Richard
Mark
I'm really close to having this work, but I'm stuck on one final bit, and I was hoping someone could take a peek for me. Right now, I have the following code:
$name = '';
$postlimit = get_option('posts_per_page');
$query = new WP_Query('showposts=' . $postlimit);
if($query->have_posts()) : while($query->have_posts()) : $query->the_post();
$author = get_the_author();
if($author != $name) {
$name = $author;
$count = '1';
}
if($count == '1') {
get_my_image('avatar'); // this is another custom function
echo $name . '<br />';
}
$count++;
endwhile;
endif;
It's REALLY close, but the above lists:
admin
Richard
Mark
admin
When I echo out the count, the final "admin" (the second one that shows up) is given a count of "1". It *should* be giving it "2", and thus not displaying it. Would anyone know what I could do to fix this? Any help would be appreciated.