Calendars Query
The calendar.calendars template query fetches a list of calendars based on some or no criteria.
Parameters
id
- The unique calendar ID
- Can be passed as an array of ID's -
[1, 2, 3]
- Use
"not 1,2,3"
to filter out calendars which don't have an ID of 1, 2 or 3 - Use
"!= 3"
to filter out calendars which don't have an ID of 3
name
- same usage as listed above for
id
- same usage as listed above for
handle
- same usage as listed above for
id
- same usage as listed above for
color
- a hex value of the color, e.g -
#FFFFFF
- a hex value of the color, e.g -
orderBy
- Valid orderBy attributes are
id
,name
,handle
andcolor
- Valid orderBy attributes are
sort
- Options are
ASC
orDESC
- Options are
limit
- An
int
limiting the result count
- An
Usage in Templates
{% set calendars = craft.calendar.calendars({
orderBy: "name",
sort: "asc"
}) %}
{% for calendar in calendars %}
<div style="color: {{ calendar.color }};">
{{ calendar.name }}
</div>
{% endfor %}