Need to search Vanytage listings by a paticular category in php
I hope somebody can help. I need to create a custom home page where it only shows vantage listings by one product-listing category.
This is the code to query the db and hopefully return listings in the 'product-listing' category. However, it returns no results when I add the tax_query part.
There are two listings in that category. What am I doing wrong?
global $va_options, $wpdb;
$args = array(
'post_type' => VA_LISTING_PTYPE,
'posts_per_page' => $va_options->listings_per_page,
'tax_query' => array(
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => array( 'product-listing' )
)
),
'order' => 'asc'
);
$orderby = $va_options->default_listing_home_sort;
$args['orderby'] = $orderby;
$args['va_orderby'] = $orderby;
$query = new WP_Query( $args );
return $query;