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'm using the ClassiPress theme as a base for a new theme. If you have worked with classipress, you should know that classipress handles its own category using the taxonomy ad_cat.
That said, I have a category named 7star and the following query to get the posts inside that category:

$the_query = new WP_Query( array('post_type'=>'ad_listing','category_name'=> '7star') );

Unfortunately this query does not work. It only fetches the posts withing categories that are of type category not ad_cat.
Anybody got any idea how to solve this?
I'm trying to avoid using manual sql query.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Well, I should have used the tax_query parameter. Something like the following:

$the_query = new WP_Query( array('post_type'=>'ad_listing',
'tax_query' => array(
    array(
        'taxonomy' => 'ad_cat',
        'field' => 'slug',
        'terms' => '7star'
    )
)
) );
share|improve this answer
add comment

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.