I'm trying to get a custom query working in a view for a "tour" CPT. I want either all the tours in the future, or all the past ones and ones that don't have a departure date set. I can successfully get all the past ones, or all the ones with no date set but I can't get them both at the same time. I think I have the syntax right but it isn't working. Anyone able to help?
{% if date_tense == 'future' %}
{% set date_query = [{
key: 'departure_date',
value: 'now'|date("Y-m-d"),
compare: '>=',
type: 'DATE'
}] %}
{% else %}
{% set date_query = [
'relation': 'OR',
{
key: 'departure_date',
value: 'now'|date("Y-m-d"),
compare: '<',
type: 'DATE'
},
{
key: 'departure_date',
compare: 'NOT EXISTS',
type: 'DATE'
}] %}
{% endif %}
{% set query_args = { post_type: 'tour', posts_per_page: -1, meta_query: date_query } %}