I am trying to setup an events section similar to that of Yelp's Events. They have a listing of all the upcoming events and have filters on the side for "Today, Tomorrow" etc...

I received help from Brandon Kelly and will be posting my answer below.

  • 1
    This seems like a valuable Q&A, Mark. I think the question could be better if it was more descriptive and self-contained, leaving room for other answers if any are so bold as to compete with Mr. Kelly. I enjoy pretending I'm two different people asking and answering, though I can follow up on that with a therapist.
    – Matt Stein
    Commented Jun 13, 2014 at 22:12

1 Answer 1


Thanks to Brandon Kelly's help I now have Events being filtered by my custom date field called eventDate by doing the following:

{% set day = date(craft.request.getSegment(2)) %}
{% set nextDay = day|date_modify('+1 day') %}
{% set events = craft.entries.eventDate('and, >= '~day|date('Y-m-d')~', <'~nextDay|date('Y-m-d')) %}

I have some links in my side bar that append the appropriate Date to the URL:

<a href="{{ url('events/'~now|date('Y-m-d')) }}">Today</a>
<a href="{{ url('events/'~nextDay|date('Y-m-d')) }}">Tomorrow</a>

And finally I just loop that through like so:

{% for block in events %}{% endfor %}

I hope someone else can find this as handy as I did through Brandon's help!

  • 1
    This awesome and a great example of Twig's awesomeness. Commented Jun 13, 2014 at 23:23
  • This thread will come in handy as we need to do something similar on the site we just started building. Thanks for posting it! Commented Apr 15, 2017 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.