i have searched and found some aprroved answers to similer questions
but nothing i could make work or something exactly like my issue…
i have 5 custom post type…
each one have its own taxmonies and inside all of them i have created
a category called specials… i need to pull all posts marked with
this category from all post types…
i have currently stuck starring at this code which doesent work..
$itemsAmount = of_get_option('sg_specials_amount');
query_posts(array(
'post_type' => array('engagement_ring', 'wedding_ring', 'pendants', 'earrings', 'bracelets'),
'posts_per_page' => $itemsAmount,
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'wedding_cat',
'field' => 'slug',
'terms' => 'specials'
),
array(
'taxonomy' => 'engagement_cat',
'field' => 'slug',
'terms' => 'specials'
)
),
'orderby' => 'rand',
'paged' => get_query_var('paged')
) );
(in this example code trying to pull just from two taxomonies but would use five)
.
if relevant then beneath the code i pasted here i have
the loop which can be found here: http://pastebin.com/ds4kFptq
Would appreciate your help
Sagive.
At a glance, I would guess that the problem is your use of
Using
AND
means that you will only return items that fall into all of the taxonomy terms. If you want to return items have any of the taxonomy items, change it toIf that “doesn’t work”, please provide more details about what “it doesn’t work” means 🙂