author.php not listing co-author's posts
-
Hi,
How can I get the co-authors’ posts listed on author.php for a custom post type? At the moment, the post appears listed only in the first author’s profile, but not in their co-authors’ profiles.
Here’s my code.
<?php $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($coauthor)); $args = array( 'author' => $author, 'posts_per_page' => -1, 'post_type' => 'bookshelf', 'post_status' => 'publish', ); // The Query $the_query = new WP_Query( $args ); // The Loop if ( $the_query->have_posts() ) { echo '<div class="masonry-item"><h2>Bookshelf</h2>'; echo '<ul>'; while ( $the_query->have_posts() ) { $the_query->the_post(); echo '<li>'; echo '<a href="'.get_permalink().'">'.get_the_title().'</a>'; echo '</li>'; } echo '</ul></div>'; } else { // no posts found } wp_reset_postdata(); ?>
What am I doing wrong? Please help!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘author.php not listing co-author's posts’ is closed to new replies.