I have a CPT that has multiple authors. I've added the multiple author functionality with the Co-Author plugin https://wordpress.org/plugins/co-authors-plus/
I also have an author page (author.php) that should list the CPT associated with the author. This is fine as long as the CPT has a single author. If the CPT has multiple author assigned it only recognizes the 'first' listed author and not the other authors.
To show the CPT(s) the author is assigned to I'm using the following code:
<?php if(isset($_GET['author_name'])) : $curauth = get_userdatabylogin($author_name); else : $curauth = get_userdata(intval($author)); endif; ?> <?php $loopTypes = new WP_Query( array( 'post_type' => 'opleidingen', 'author' => $curauth->ID ));?> <ul> <?php if ($loopTypes->have_posts()) : while ($loopTypes->have_posts()) : $loopTypes->the_post(); ?> <li><a href="<?php the_permalink (); ?>"><?php the_title (); ?></a></li> <?php endwhile; ?> </ul> <?php else : ?> <?php endif; ?> <?php wp_reset_query();?>
Is there a way to alter/extend this code to display all assigned authors of the CPT and not only the first one?