so what you want is get posts by state name and then when outputting them sort them by city.
maybe you could try that, instead of having 2
set up your
$args like that:
$args = array( 'numberposts' => -1, 'post_type' => 'OGs', 'orderby' => 'meta_value', 'order' => 'DESC', 'meta_key' => 'city', );
this code above should return all the OGs posts ordered by city however the states part is missing i don’t know if you can add it as below.
$args = array( 'numberposts' => -1, 'post_type' => 'OGs', 'orderby' => 'meta_value', 'order' => 'DESC', 'meta_key' => 'city', 'meta_query' => array( array( 'key' => 'state', 'value' => 'Texas', ), );
I diden’t test that but looks like the ‘orderby’ => ‘meta_value’ is a good start.
let me know how it goes
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!
© 2022 Advanced Custom Fields.