Show all posts by the author, where he is the main author and co-author
-
Hello.
How to display all posts by an author where he is the main author and co-author? On the author page.Му code
<?php get_header(); get_coauthors( $post_id ); $page = get_query_var('paged') ? get_query_var('paged') : 1; $page_offset = ($page-1) * 8; $authors = get_queried_object()->ID; $author_id = wp_list_pluck( get_coauthors( $post_id ), 'ID'); $coauthor_id = join(', ', $author_id); ?> <?php $postslist = get_posts( array( 'posts_per_page' => 10, 'offset' => $page_offset, 'author__in' => $authors, 'orderby' => 'date', 'order' => 'DESC', 'post_type' => 'post') ); ?> <?php foreach ($postslist as $post) : setup_postdata($post); ?> <div class="article_image"> <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'article_arhive' ); ?></a> </div> <?php endforeach; ?> <?php wp_reset_postdata() ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Show all posts by the author, where he is the main author and co-author’ is closed to new replies.