I have a custom post type called “property”.
Each property has an ACF checkbox fields called “property_status” with the following options:
rent : For Rent
rented : Rented
sale : For Sale
sold : Sold Homes
new : Under Construction
Each property also has a featured listing ACF radio button field called “property_featured” with the following options:
no : No
yes : Yes
I have successfully queried the posts to show up using the following code:
$paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
$args = array(
'post_type' => 'property',
'posts_per_page' => 12,
'meta_key' => 'property_status',
'orderby' => array(
'property_featured' => 'ASC',
'property_status' => 'ASC'
),
'order' => 'ASC',
'paged' => $paged
);
$wp_query = new WP_Query( $args );
I need to order my posts by calling the featured properties with a radio button selection of “yes : Yes”, then display the other posts under “properties” by their ‘property_status’ of rent, rent and new, sale, then sale and new. Some properties can have 2 check boxes selected in the “property_status” field such as a property for rent, but that is all “new” under construction.
I have tried several different query declarations to try and display these custom posts by the order I need, but have not had any success. The code above is what I am using.