I had a similar aproach some days ago
//.....
'meta_query' => array(
'relation' => 'OR',
array(
'pin_clause' = array(
'meta_key' => 'pin_to_top',
'meta_type' => 'NUMERIC',
'meta_value_num' => '1',
'compare' => '='
)
),
array(
'date_clause' => array(
'meta_key' => '_EventStartDate',
'meta_type' => 'DATETIME',
'meta_value' => '$today',
'compare' => '>='
)
)
),
'orderby' => array(
'pin_clause' => 'DESC',
'date_clause' => 'ASC'
)
//....
I don’t know if I got your names right, but I think it will help to understand the trick.
Related Posts:
- WP REST API: Order posts by meta value (acf)?
- sort by date in Advanced Custom Field
- Display post in order of ACF checkbox?
- Order get_terms by multiple meta_values
- Multiple orderby date arguments
- WP Query with meta queries
- ACF order relationship by date
- Ignoring initial articles (like ‘a’, ‘an’ or ‘the’) when sorting queries?
- ORDER BY custom field value
- Sorting: custom query with orderby meta_value_num THEN by title
- Order get_terms using a Custom Field
- Custom Post type sort order not working in the admin area
- wordpress REST-API upload image to ACF
- Ascending sort order for monthly & category view, i.e. ?m=201204, ?cat=4
- How to add a custom field to quick edit
- Gutenberg First Block on Page Conditional?
- Comparing arrays with meta_query in pre_get_posts
- How to order by just the Time Field in Advanced Custom Fields
- Using Gutenberg parse_blocks Function With ACF Custom Blocks?
- Sorting posts by multiple values, combined
- How to update custom taxonomy meta using ACF update_field() function or any other wordpress function
- Thumbnails generated from PDF in the “Media” section – how to show them in theme template?
- How to count ACF Flexible Content Rows?
- Query between dates using date picker filter breaks in WordPress 4.2.1
- Get ACF value after update user using save_post
- random p tag in advanced custom fields?
- How to write PHP array to render JSON-LD Markup for Job Postings, with ACF
- Advanced Custom Fields: Conditional Statement with Select
- Add PDF to ACF image field from file url
- WP_Query: Group events by year, sorted DESC; then by date for each year group, sorted ASC
- Order RSS content by an advanced custom field value
- Understanding the orderby in WP_Query?
- Bulk-Update Custom Posts
- Group ACF repeater fields from differrent posts
- How to get custom fields in a post when published
- Get all custom fields with wp’s get_posts()
- How to populate a parent page with its child subpages and associated templates
- Find the first occurrence of a custom field
- Custom post type sorting: alphabetical order
- Sort a custom post with ACF: Date Picker & Display Featured!
- ACF Relationship – Limit to specific pages
- Website goes down while importing backup (Internal server 500)
- Display total unique custon field results
- Advanced custom fields – pulling data in from another page
- I would like my page editor to be sorted by date created, or updated, instead of in Alpha order, is this possible?
- ACF: If field contain a specific value, update value in another field programatically
- Custom Post Type page sorts differently on different environments
- how to load random related posts with specific custom fields?
- Displaying user data within ACF relational field (user type)
- ACF Image field not displaying in WordPress with Visual Composer [closed]
- get_previous_post() while accounting for sticky posts
- How to acquire an ACF image using get_previous_post and get_next_post
- ACF checkbox array is returning numbers, not labels [closed]
- Showing a post depending on the Custom Field value
- Advanced Custom Fields – category image
- Widget Code / Advanced Custom Fields / Elementor
- How can I apply an ACF field to a single custom post if it refers to the taxomy of that post type in the rules?
- ACF: Update field value based on value of another field
- Getting “Years Only ” from ACF Date Picker field to Hidden filed in the fields group
- Prevent other hooks from firing after wp_update_post() outside of editor
- Where to place CSS if add a new layout to FLexible Content Template
- Trying to update repeater field (ACF) dynamically with data from Contact Forms 7
- Get title color from category custom field
- WP Cron Working, but Function Not Working
- Explore custom posts (CPT UI & ACF) database from WP UI
- pre_get_posts hook not targeting search results page query
- ACF – get custom taxonomy term image field
- ACF group field disappeared after deployment using deployer script
- get the title of a relationship field
- ACF Dynamic select not showing data
- Modification of RSS feed is not consistent
- How to call ACF field in functions?
- Order by value of Custom Field using url string
- How to use WP Backery on Wysiwyg ACF
- wp query multiple values > display a specific value first
- Create Shortcode for php code in functions.php
- Wp Query sort order from custom MetaBox
- ACF: Updating gallery field doesn’t work in backend
- Multiple sorting criteries (order by)
- Using Orderby and meta_value to order natural/alphanumerical
- Pulling author name via $_GET parameter
- Srcset incorrect with Owl Carousel and ACF?
- Rearranging Content After Blog Post
- Advanced Custom Fields – Google Map Won’t Render Unless Variable Dumped
- Best way to sort posts with different types by distance
- ACF scheduled repeater fields
- Get the category fields even if there is no post
- Advanced Custom Fields Show After Password [closed]
- Custome column sort by date not title
- How to order posts by the user_login that corresponds to a meta_value (which is a user id)?
- query_posts with sorting on a custom datestamp
- Multiple loop issue – pull one featured and then continue the loop
- List CPT by menu_order with children right after parent
- Check if meta_key exists in wp_list_pages
- ACF + WPML: How to translate date fields?
- Using ACF custom field for custom post type to order categories
- PHP calls to custom fields not being made. Query seems to be blocking them
- Sort wordpress posts by facebook likes [closed]
- show only first element from a type with acf
- ACF – if field has value within Field Group conditional statement [closed]