0

I am using the following code to display an archived list of months from my calendar with clickable links.

<ul>
    {exp:calendar:month_list date_range_start="{today}"}
        <li>
            <a href="{path='events/archives'}/{month format="%Y/%m"}"/>
                {month format="%F, %Y"}
            </a>
        </li>   
    {/exp:calendar:month_list}
</ul>

I only want to display months that have events in them. Does anyone know how this can be done?

2

The {exp:calendar:cal} tag can do a lot in Calendar: it's the first go-to tag to consider. I would use it since it provides a {month_event_total} variable you could use here. For example:

{exp:calendar:cal date_range_start="2015-01-01" date_range_end="2015-12-31"}
    {display_each_month}
        {if month_event_total > 0}
            // Your month header
        {/if}
    {/display_each_month}
{/exp:calendar:cal}

That should just display months that have events in them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.