Query multiple post types, but different order for each
I have a query which searches 2 post types as below:
$args = array(
'post_type' = ['post', 'promotion'],
'posts_per_page' = 12,
'paged' = $paged,
's' = isset($_GET['search']) ? $_GET['search'] : '',
);
This orders them by default, by published date.
I need to add a third post type events
. This however needs to be sorted by a custom field event_date
asc
and to disregard those which the event_date
is in the past. Does anyone have any suggestions on how this could be done? While keeping the pagination and search.
Thanks in advance
F
Topic meta-query wp-query custom-field query Wordpress
Category Web