I have a channel section with a handle named 'events'.

In my field layout for this section I have a field named eventsDate, which is a Date/Time field.

I also have a plain text field called 'eventsHeadline'.

What would be a good way to output the 'eventsHeadline' entries ordered by 'eventsDate'?

  • Is "eventsFeed" an entries field or did you mean it's a section? If it really is an entries field, what's the section handle of your sections and where do you use the datetime field "eventsDate"?
    – carlcs
    Commented Jul 15, 2014 at 9:35
  • Ok. "eventsFeed" is missing altogether now, updated my answer :)
    – carlcs
    Commented Jul 15, 2014 at 14:19

1 Answer 1


Read the article about ElementCriteriaModel in the official Craft docs on how to query elements in general and the craft.entries article about the parameter available to modify the object returned.

Example code for your events list:

{# Get events from `events` section in desired sort order #}
{% set allEvents = craft.entries.section('events').order('eventsDate desc') %}

{# Loop through `allEvents` and print the list #}
{% for event in allEvents %}
    <li>{{ event.eventsHeadline }} - {{ event.eventsDate|date('F j, Y') }}</li>
{% endfor %}
  • If I was wrong and "eventsFeed" is an entries field, query your events with the relatedTo() parameter.
    – carlcs
    Commented Jul 15, 2014 at 10:41
  • Yes, eventsFeed is an entries field, . Could you update your example code for the events list? Meanwhile, I'll read the articles you suggested.
    – osh
    Commented Jul 15, 2014 at 11:03
  • I can't because you first have to provide more info.
    – carlcs
    Commented Jul 15, 2014 at 11:06
  • Sorry about that. I just updated my question.
    – osh
    Commented Jul 15, 2014 at 11:59

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.