Contributor appearing in list of authors
-
I’m using the following code to output a page that shows a list of all of my 20 or so authors. It’s working fine, except for this weirdness: I promoted a contributor to an author as a test, then put him back to contributor. However, he’s still showing up on this list, though none of the other contributors are. I’ve double-checked that his role has indeed been set back to contributor. Is there something wrong in my code that’s causing that?
Here’s my code:
<?php /** * Template Name: All Author Archives */ get_header();?> <div id="all-authors-archive"> <h1 style="font-family: 'Noto Sans', sans-serif;"><?php the_title(); ?></h1> <?php // Arguments to pass to get_users $args = array( 'orderby' => 'post_count', 'order' => 'DESC', 'who' => 'authors', 'exclude' => '1, 31052', 'post_type' => 'post', 'post_status' => 'publish' ); // Query for the users $authors = get_users_ordered_by_post_date( $args ); ?> <?php // Loop through all the users, printing all of their posts as we go foreach ( $authors as $author ) { ?> <a name="<?php echo $author->user_nicename; ?>"></a> <div class="author-posts-wrapper" id="author-<?php echo $author->ID; ?>-posts-wrapper"> <div class="author-posts" id="author-<?php echo $author->ID; ?>-posts"> <div id="author-page-name"><a href="<?php echo get_author_posts_url( $author->ID ); ?>"><?php echo $author->display_name; ?></a><br> </div> <div id="author_bio"><?php echo $author->description; ?></div><br> <div id="authors_recently"><em>Recently: </em> <?php // Set up a Loop, querying for all of the current user's posts $args = array( 'author' => $author->ID, 'posts_per_page' => 1 ); $posts = query_posts($args); // Now that we have the posts, simulate a Loop here or use get_template_part // if we already have the output in another template, like: // get_template_part( 'loop', 'all-authors' ); // Pulls in loop-all-authors.php from theme if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); // Print whatever we want for each post - for now the title and date ?> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a> — <?php echo get_the_date(); ?> <?php endwhile; ?> </div><!-- #author-post-list --> <?php else: ?> <p>This author has not yet published any posts</p> <?php endif; ?> </div><!-- #author-posts --> </div><!-- #author-posts-wrapper --> <hr><?php } // End looping over all users ?> </div><!-- #all-authors-archive --> <?php get_footer(); ?>
- The topic ‘Contributor appearing in list of authors’ is closed to new replies.