I have a custom post type called, “portfolio”
In CPT “portfolio”, I have custom fields (checkbox true or false), “include_case_study” and “include_review”, and a conditional field called, “include_video_review” if “include_review” is true.
Okay, so, I am using WP_Query with custom $args to query all portfolio posts with “include_case_study” checked.
I want to order those posts in a certain way, but just don’t know how to do it. I’d like the posts to be ordered like this:
First Priority: posts with all three fields checked: include_case_study, include_review and include_video_review
Then: posts with just these fields are checked: include_case_study, include_review
Last: posts with only this field is checked: include_case_study
This is how my $args looks like:
$args = array(
'post_type' => $portfolio,
'meta_query' => array(
array(
'key' => 'include_case_study',
'value' => '1',
'compare' => '==',
),
),
'posts_per_page' => 7,
'orderby' => 'date',
'order' => 'DESC'
)
Thanks in advance for all your help!