Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

At a glance, I would guess that the problem is your use of

'relation' => 'AND'

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 to

'relation' => 'OR'

If that "doesn't work", please provide more details about what "it doesn't work" means :)

share|improve this answer
    
thank you very much. –  Sagive SEO Mar 25 '12 at 19:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.