Calling all posts in a custom post type taxonomy
-
Hi!
At the moment, I’m using this code:
<?php $args=array( 'reviews_author' => 'author', 'post_type' => 'reviews', 'posts_per_page' => 10, 'caller_get_posts'=> 1 ); $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); ?> <a title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_post_thumbnail('tiny', array ('class' => 'alignleft')); ?></a> <?php endwhile; } wp_reset_query(); // Restore global post data stomped by the_post(). ?>
To generate the thumbnails of posts which are in a custom post type taxonomy. However, rather than having to input the ‘author’ for the ‘reviews_author’ array entry, I would like it to generate it automatically depending on what post it is displaying. For example, if I’m currently displaying a post that is part of the custom post type taxonomy “cats”, I want it to display all other posts in the taxonomy “cats”, but at the same time, if a post is part of the taxonomy “dogs”, I want it to display those in “dogs”. Does that make sense?
Thanks in advance!
- The topic ‘Calling all posts in a custom post type taxonomy’ is closed to new replies.