Is it possible using WP_Query to return a filtered list of items based on the following criteria set? I seem to be struggling as there are numerous queries against custom fields.
Select all posts that are of type business_club (post_type)
Where the post has a zone of 'Asia' (meta_value)
Order by country ASC (meta_value)
then by town ASC (meta_value)
then by title (wp value)
Any help is greatly appreciated.
3 Answers
Did you try something like this:
$loop = new WP_Query( array(
'post_type' => 'business_club',
'meta_value' => 'United Kingdom',
'order' => 'ASC',
'orderby' => 'meta_value',
'meta_key' => 'zone'
) );
while ( $loop->have_posts() ) : $loop->the_post();
I don’t know yet if you can do the then orderby town and title.