Home › Forums › General Issues › Querying by Post Object value › Reply To: Querying by Post Object value
John, this is great, thank you (as always). It worked exactly as you suggested.
I am now trying, however, to make sure I can still present them in date order (the other meta query). I’ve been using this to do that in other feeds:
'orderby' => 'meta_value_num',
'order' => 'ASC',
'nopaging' => true
Of course, now there are two meta queries, there are two meta values too, so how can I specify which is to be used for ordering? At the moment it seems a bit confused.
Here’s the whole thing as it stands currently:
$byartist_args = (array(
'numberposts' => -1,
'post_type' => 'Event',
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'artist',
'value' => get_the_ID(),
'compare' => '=',
),
array(
'key' => 'event_date',
'compare' => 'BETWEEN',
'type' => 'DATE',
'value' => array($date_1, $date_2),
),
),
'orderby' => 'meta_value_num',
'order' => 'ASC',
'nopaging' => true
));
Thank you!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.