I've been trying to pull the query off but I can't manage to do it. I want to query all the post in the category 'locales'. Then sort them by custom field value 'provincia', and then sort them by custom field value 'localidad'. I dont know if I'm being clear, I need to sort all 'locales' in for example, USA, and then sort those again by all the states. I've seen a lot of trick but no one worked.
I think the closer I got was this:
$entradas = new WP_Query( array (
'post_type' => 'post',
'category_name' => 'locales',
'meta_query' => array(
array(
'key' => 'provincia'
),
array(
'key' => 'localidad'
)
),
'orderby' => 'meta_value meta_value',
'order' => 'ASC',
'nopaging' => true,
'posts_per_page' => -1
));
But of course it doesn't work. Do anyone know a solution? Help me!
Thank you!
For that you need to call custom query: