Created
February 18, 2014 15:58
-
-
Save dustinwalker/9073738 to your computer and use it in GitHub Desktop.
List events in CraftCMS
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
{# | |
# SECTION_NAME is the name of the section for events | |
# allEvents, futureEvents, event can be anything | |
# Not sure where I got this sample from | |
#} | |
{% set allEvents = craft.entries.section('SECTION_NAME').limit(3).find() %} | |
{% set futureEvents = [] %} | |
{% for event in allEvents %} | |
{% if event.dateOfEvent | date('U') >= 'now' | date('U') %} | |
{% set futureEvents = futureEvents | merge([event]) %} | |
{% endif %} | |
{% endfor %} | |
{% for event in futureEvents | sort('event.dateOfEvent') %} | |
<li> | |
<h4>{{ event.title }}</h4> | |
</a> | |
</li> | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment