Skip to main content
2 of 3
Would be better to use the first() method instead of setting a limit.
Jamie Wade
  • 3.6k
  • 2
  • 17
  • 32

When you are setting nextEvent, you can limit only events that are upcoming and only output the first result you get back like so:

.startDate('>= ' ~ now).first()

So you can take that and update your code like so:

{% set nextEvent = craft.entries.section('events').order('startDate').startDate('>= ' ~ now).first() %}

{% for entry in nextEvent %}
    foo
{% endfor %}

I have assumed you have a section called 'Event's until we get some clarification as to what craft.events.events is.

Jamie Wade
  • 3.6k
  • 2
  • 17
  • 32