I setup my archive using the Craft demo. I have a page for each year.
I use MixItUp,(think Isotope) to allow a user to filter entries by month. There are simple hard coded buttons for each month.
How can I loop through the entries and create a button for only those months that have entries?
Update. I have a loop that pulls all the entries for a given year. I then use MixItUp (think Isotope) to filter the entries by month.
There is a button for each month that triggers MixItUp. I want to make the creation of these buttons dynamic. That is, I want to create a loop that generates a button for only those months that contain entries and create a class with the month's name that corresponds with the month in the class names of the entry cards.
For any given year, the loop would create 1-12 buttons.
{% for month that has > 0 entries %}
<button type="button" class="btn btn-outline-secondary btn-lg" data-mixitup-control data-filter=".February">Feb</button>
{% endfor %}
Thanks