function va_get_featured_listings() {
global $va_options;
$args = array(
'post_type' => VA_LISTING_PTYPE,
'posts_per_page' => $va_options->featured_per_page,
'paged' => get_query_var( 'page' ),
);
$args = apply_filters( 'va_featured_listings_args', $args );
if ( is_tax( VA_LISTING_CATEGORY ) ) {
$where = 'cat';
$args['tax_query'] = array(
array(
'taxonomy' => VA_LISTING_CATEGORY,
'terms' => array( get_queried_object_id() )
)
);
} elseif ( is_front_page() ) {
$where = 'home';
}
else {
return;
}
$args['meta_key'] = 'featured-' . $where;
$args['meta_value'] = 1;
$query = new WP_Query( $args );
if ( !$query->have_posts() )
return;
return $query;
}
There are currently 1 users browsing this thread. (0 members and 1 guests)