0

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.

1

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'
    )
)
) );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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