-
-
Save pixeldeluxe/120e96c5e995a5491b54 to your computer and use it in GitHub Desktop.
Craft CMS future events listings, sorted by date and grouped by month and year. Requires Danny Nimmo's SortByField plugin. https://github.com/dannynimmo/craftcms-sortbyfield
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set allEvents = craft.entries.section('events').find() %} | |
{% set futureEvents = [] %} | |
{% for event in allEvents %} | |
{% if event.startDate | date('U') >= 'now' | date('U') %} | |
{% set futureEvents = futureEvents | merge([event]) %} | |
{% endif %} | |
{% endfor %} | |
{% for date, events in futureEvents | sortByField('startDate') | group('startDate|date("F Y")') %} | |
<h1>{{ date }}</h1> | |
<ul> | |
{% for event in events %} | |
<li>{{ event.title }}</li> | |
{% endfor %} | |
</ul> | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment