[ad_1]
I want to sort my cars by two custom fields but can’t get this working properly.
So the primary field would be has_photos order by DESC this never change (I get this one).
The issue is… users can also sort by Price (Low/High) and I can’t find a way to add both custom fields to the sort criteria… but I can only use one of them “price or has_photo”.
'meta_key' => $meta_key,
'orderby' => [$meta_value_text => $meta_value]);I also tried something like this:
$arg = array('posts_per_page' => $posts_per_page,
'paged' => $paged,
'post_type' => 'inventory',
'meta_query' => array(
array(
'key' => 'has_photos',
'orderby' => 'meta_value',
'order' => 'DESC',
),
array(
'key' => $meta_key,
'orderby' => $meta_value_text,
'order' => $meta_value,
),
'relation' => 'AND', $filter));
