1) Custom Post Type named "Buying_Locations"
2) Each Post has three meta values of: State, City, Store Name
QUESTION: How can you show a list of these posts sorted alphabetically by State, then City and then the Store Name? For example...
STATE 1
CITY 1
- STORE NAME
- STORE NAME
- STORE NAME
CITY 2
- STORE NAME
- STORE NAME
- STORE NAME
CITY 3
- STORE NAME
- STORE NAME
- STORE NAME
STATE 2
CITY 1
- STORE NAME
- STORE NAME
- STORE NAME
CITY 2
- STORE NAME
- STORE NAME
- STORE NAME
STATE 3
CITY 1
- STORE NAME
- STORE NAME
CITY 2
- STORE NAME
- STORE NAME
- STORE NAME
CITY 3
- STORE NAME
I've gotten a little further with this:
$mypost = array(
'post_type' => 'buy_locations',
'posts_per_page' => -1,
'meta_key' => 'store_city',
'orderby' => 'meta_value title',
'order' => 'ASC'
);
$loop = new WP_Query( $mypost );
Just need to figure out how to sort by the State first, then the city, then title.
Not sure how to add the extra "meta_key" value.
How do I add the 3rd sorting request?
$mypost = array(
'post_type' => 'buy_locations',
'posts_per_page' => -1,
'meta_key1' => 'store_state',
'meta_key2' => 'store_city',
'orderby' => 'meta_value1 meta_value2 title',
'order' => 'ASC'
);