Hi Zoe,
Thank you for contacting us and I'll be happy to assist.
Your observation is correct and this behavior is due to a limitation in the WordPress query when it is set to order posts based on custom field values.
( ref: https://codex.wordpress.org/Class_Reference/WP_Meta_Query )
To overcome this and show all events, you can use the following steps:
1. First, please a create a view that shows events ordered by your date custom field value. At this point, events which are without a set date won't show.
2. Next, you can duplicate that view, but in this new view's "Ordering" section, select "Order by" field to "Post title".
3. To make this new view show only event posts without a set date field, you can add the following code in the active theme's "functions.php" file:
add_filter( 'wpv_filter_query', 'filter_date_custom_fn', 1000 , 3 );
function filter_date_custom_fn( $query_args, $view_settings ) {
if ( (!is_admin() && isset($view_settings['view_id'])) && ($view_settings['view_id'] == 1234) ) {
$query_args['meta_query'] = array(
'relation' => 'OR',
'date_field' => array(
'key' => 'wpcf-date-field-slug',
'compare' => 'NOT EXISTS',
),
);
}
return $query_args;
}
Note: Please replace "1234" with the actual ID of this new view and "date-field-slug" with the actual slug of your date field.
(making sure that it starts with "wpcf-")
4. As a result, with help of these two views, you'll be able to show the complete list of events, by placing their shortcodes on top of each other.
I hope this helps and let me know if you have any questions related to this setup.
regards,
Waqar