Calendar:Month_List template tag
The Calendar:Month_List loop outputs an archive list of months for the purpose of generating simple lists to link to full Month calendars.
{exp:calendar:month_list} content {/exp:calendar:month_list}
Parameters
date_range_start=
date_range_start="6 months ago"
Required to set start date of months. Both standard and easy-to-use text date formatting apply to this parameter. This parameter defaults to today (current month) when no value specified.
date_range_end=
date_range_end="6 months"
Use this parameter to set end date of months. If this parameter is not specified, then the default limit of 12 results will kick in, unless a different value is specified in the limit parameter. Both standard and easy-to-use text date formatting apply to this parameter.
limit=
limit="18"
This parameter allows you to limit the amount of month results to be displayed in the list. Default is 12 months. If this parameter is not specified, the default value of this parameter only kicks in when the date_range_end parameter is not used.
Variables
calendar:date
{calendar:date format="%F, %Y"}
Displays the given month and year, formatted using EE date formatting.
Conditionals
calendar:current_month
{if calendar:current_month}Current Month{/if}
This conditional will display its contents if the month in the list of results is today's month.
calendar:current_year
{if calendar:current_year}Current Year{/if}
This conditional will display its contents if the month in the list of results is in the current year.
Examples
The following code will display a list of months during the period of January, 2015 - December, 2017:
<ul>
{exp:calendar:month_list date_range_start="2015-01-01"
date_range_end="2017-12-last" limit="36" }
<li>
<a href="{path='calendar/month'}/{calendar:date format='%Y/%m'}/">
{calendar:date format="%F, %Y"}
</a>
</li>
{/exp:calendar:month_list}
</ul>
The following code will display a list of all months in the current year:
<ul>
{exp:calendar:month_list date_range_start="year-01-01"
date_range_end="year-12-last" limit="12" }
<li>
<a href="{path='calendar/month'}/{calendar:date format='%Y/%m'}/">
{calendar:date format="%F, %Y"}
</a>
</li>
{/exp:calendar:month_list}
</ul>
The following code will display a rolling year list of all 12 months, but relative to current month:
<ul>
{exp:calendar:month_list date_range_start="6 months ago" date_range_end="6
months" limit="12" }
<li>
<a href="{path='calendar/month'}/{calendar:date format='%Y/%m'}/">
{calendar:date format="%F, %Y"}
</a>
</li>
{/exp:calendar:month_list}
</ul>