Display post in order of ACF checkbox?
I have a custom post type called ‘Skateboards’. Within the custom post type of ‘Skateboards’ , I added three checkboxes (filed type checkbox) with a field name of ‘skateboard_performance’ associated to the ’Skateboards’ custom post type via ACF. The values of the three check boxes are ‘Platinum’ , ‘Gold’ and ‘Silver ’.
What I am trying to accomplish is to display the ‘Skateboards’ post type in order of ‘Platinum’ , ‘Gold’ and ‘Silver’. So all of the Skateboards posts marked with ‘Platinum’ checkbox will display 1st. Followed by all Skateboards posts marked with ‘Gold’ checkbox to display 2nd and then all skateboards posts marked with ‘Silver’ to display 3rd.
Any ideas on what the $args to do that would look like?
So far i got up to here but I am having difficulty ordering them correctly :
$args = get_posts(array(
‘post_type’ = ‘skateboards’, //insert the correct post_type name
‘posts_per_page’ = -1,
‘meta_key’ = ‘skateboard_performance’, //sample acf field name
‘orderby’ = ‘meta_value’,
‘order’ = ‘ASC’
));
Topic advanced-custom-fields meta-query order Wordpress
Category Web