Query posts using same taxonomy term
I have custom post types sharing a “Brands” taxonomy with posts.
I would like to query and list 5 posts (post type “post”) in the custom post type “single” template.
The trick is that i’d like to query posts that use the same “Brands” term.
<?php global $wp_query; query_posts(array('post_type' => 'post', "Brands" => "term_name", 'showposts' => 5 )); if (have_posts()) : while (have_posts()) : the_post(); ?>
In this example “term_name” is hard coded and i’d like it to pick up the current custom post type’s “Brands” term (i.e. Cadillac).
This must be very simple but i’m stuck here.
- The topic ‘Query posts using same taxonomy term’ is closed to new replies.