I have a rev slider that I want to use to display a custom post type of mine called vehicle. These vehicles have a meta field called “wpcm_featured” and its value can be either 0 for no or 1 for yes. I want my slider to display only featured vehicles and also to order them by price(wpcm_price) from low to high. The code I have now doesn’t seem to do any ordering or filtering except by post type.
function slider_hot_deals($query, $slider_id) {
// only apply the special filter for slider with "x" ID
// http://tinyurl.com/zb6hzpc
if($slider_id == 4) {
// order posts by vehicle price
$query['meta_query'] = array(
'price_clause' =>
array(
'key' => 'wpcm_price',
'type' => 'numeric'
),
'featured_clause' =>
array(
'key' => 'wpcm_featured',
'type' => 'numeric',
'value' => '1'
)
);
$query['orderby'] = 'price_clause';
$query['order'] = 'ASC';
}
return $query;
}
add_filter('revslider_get_posts', 'slider_hot_deals', 10, 2);
What am I doing wrong?