Hello Im trying to order by posts (if possible) with the Elementor Custom Query Filter. I've created an advanced custom field that is a radio button that key is "has_images" and then given a radio button either a Yes or No option. The default is "No" and when I add images I change this to Yes. Im trying to have orderby show my custom post type "vehicles" with images first then those with default placeholder ( custom field no).
The query I've come up with
add_action( 'elementor/query/jet-smart-filters', function( $query ) {
// Here we set the query to fetch posts with
// ordered by post meta
$query->set( 'meta_key', 'has_images' );
$query->set( 'orderby', 'meta_value_num' ); // for numeric meta use `meta_value_num` instead of `meta_value`
$query->set( 'order', 'ASC' ); // ordering
} );
I've tried meta_value_num and meta_value but this query only seems to show the posts with the radio button changed to yes.
Can this be done with Elementor Query?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…