I have a channel of events with a field ‘eventDate’ for the date/time of the event. Within that there are ‘types’ of events ‘eventType’. What would be the most efficient way of outputting the NEXT (future date from now) that is of the ‘eventType’ equal to ‘Green’?
So far i’ve got
{% for event in craft.entries.section('events').order('eventDate asc') %}
Which will output the entries in the correct order based on the eventDate, but can i filter the query even further to include the conditionals to only output if the date is in the future like this conditional:
{% if event.eventDate|date("c") > now|date('c') %}
And also include the conditional to only output if the eventType == ‘green’ like so:
{% if event.eventType == ‘green’ %}
So that i can set the ‘limit’ to whatever i want and ONLY have the entries that meet the conditionals be included before that limit is applied?
I know that i can use the 'Search' like so:
{% for event in craft.entries.section('events').search('eventType:green').order('eventDate asc') %}
But A. Is that the most efficient and B. How do i also include only entries that are in the FUTURE from NOW based on the eventDate field?