I have two custom post types…
BOOK and BOOK AUTHOR.
I want to…
LIST all BOOK's by an author on their respective AUTHOR PAGE.
So if i have 10 books by Stephen KING. I want to list them all (and only those by him) on the STEPHEN KING page. I am having real trouble working out how to query posts to do this.
Any advice? I am using advanced custom fields plugin if that helps, but can't work out how to query and display this post information.
I currently use the following code to display ALL of my releases, but how do i get the specific ones on their specific author pages?
<?php
$args=array(
'post_type' => 'book',
'post_status' => 'publish',
'posts_per_page' => 12,
'caller_get_posts'=> 1,
'orderby'=> 'date',
'order' => 'DESC'
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
echo '';
$i = 0;
while ($my_query->have_posts()) : $my_query->the_post();
if($i % 6 == 0) { ?>
<div class="row">
<?php
}
?>
<img src="<?php the_field('cover_image'); ?>" /><br />
<?php the_field('author_name'); ?><br />
<?php the_title(); ?><br />
</div>
<?php
if($i % 6 == 0) { ?>
<?php
}
$i++;
endwhile;
}
wp_reset_query();
?>