Hi,
I have a view with this query:
{% set terms_to_match = mb.wp_get_post_terms(post.ID, taxonomy_to_match, {fields: 'slugs'}) %}
{% set args = {
post_type: 'promotion',
numberposts: 3,
sort_column: 'content_popularity',
order: 'ASC',
tax_query: [ {
taxonomy: taxonomy_to_match,
field: 'slug',
terms: terms_to_match} ]
} %}
{% set posts = mb.get_posts(args) %}
This works fine. I wanted to add filtering on dates. I tried to add this to the arguments:
meta_query: [
{key: gmdate,
value: ['promotion_start_date', 'promotion_end_date'],
compare: 'between',
type: 'DATE'
}],
and this:
meta_query: [{
key: 'promotion_start_date',
value: gmdate,
compare: '<=',
type: 'DATE'
},
{
key: 'promotion_end_date',
value: gmdate,
compare: '>=',
type: 'DATE'
}],
The query gets executed (no syntax errors) but it does not get me the results I expect. What do need to do to get posts that have their start date before the current date+time and their end date after?
The dates are in Datetime Picker fields.