<p>You could do this multiple ways.</p>

<p>One you could create a category with each month and an input for your entries and assign that month to each category.  Then it would be a matter of calling that categories <code>relatedTo</code> param using each Month Category ID.</p>

<pre><code>{% set monthIds = craft.categories.group('months').ids() %}

{% for monthId in monthIds %}
    &lt;div&gt;
        {# group each months entries #}
        {% for item in craft.entries.section('sectionName').relatedTo({targetElement:monthId}) %}
            {# content for each entry. #}
        {% endfor %}
    &lt;/div&gt;
{% endfor %}
</code></pre>

<p>Two you could use your <code>eventStart</code> field.</p>

<pre><code>{# 1 == January #}
{% set months  = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"] %}
{% for month in 1..12 %}
    &lt;div&gt;
        {# group each months entries #}
        {% set idx = month - 1%}
        &lt;h3&gt;{{ months[idx] }}&lt;/h3&gt;
        {% for item in craft.entries.section('blog') if item.eventStart|date("n") == month %}
            {# content for each entry. #}
            &lt;h3&gt;{{item.title}}&lt;/h3&gt;
        {% endfor %}
    &lt;/div&gt;
{% endfor %}
</code></pre>

CC BY-SA 3.0
2017-02-20T04:54:31.503Z
Thank aran for the codes. I tried the last option you provided. It works perfectly but it repeat the word Month twelve times Month 1, Month 2 etc. How to use the month name instead? (Jan, Feb etc) do I have to create array name like 1 = Jan, 2 = Feb etc?
William Spark
CC BY-SA 3.0
2017-02-20T04:58:52.657Z
I have updated the answer to help you with that.
a-am
CC BY-SA 3.0
2017-02-20T05:21:37.023Z
Thank for the update. I test it and return error Internal Server Error

Unexpected character "#".
William Spark
CC BY-SA 3.0
2017-02-20T05:38:21.340Z
I have updated the answer it was missing closing brackets for month name.
a-am
CC BY-SA 3.0
2017-02-20T01:49:28.690Z
2017-02-20T05:37:57.750Z
2017-02-20T05:37:57.750Z
a-am
<p>I created html template using radio buttons as tabs as you can see in the picture. When user click on any of the tabs the relevant entries for that month display and the rest hidden. </p>

<p>I created matrix field to group the calendar field and other text fields but my question is how to dynamic display all entries for each month? So that I can use CSS to hide other entries and show entries when tab are selected.</p>

<p><a href="https://i.sstatic.net/Jn1wy.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Jn1wy.jpg" alt="enter image description here"></a>
<a href="https://i.sstatic.net/9U22c.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/9U22c.jpg" alt="enter image description here"></a></p>

<templating>
Display entries for each month
# Display entries for each month

(Asked by: username_0 on 2017-02-20)

I created html template using radio buttons as tabs as you can see in the picture. When user click on any of the tabs the relevant entries for that month display and the rest hidden.

I created matrix field to group the calendar field and other text fields but my question is how to dynamic display all entries for each month? So that I can use CSS to hide other entries and show entries when tab are selected.

[![enter image description here](https://i.sstatic.net/Jn1wy.jpg)](https://i.sstatic.net/Jn1wy.jpg)
[![enter image description here](https://i.sstatic.net/9U22c.jpg)](https://i.sstatic.net/9U22c.jpg)

**Tags:** templating


---

## 1 answers

### Answer by username_1 on 2017-02-20. Score: 3 | Accepted answer

You could do this multiple ways.
One you could create a category with each month and an input for your entries and assign that month to each category.  Then it would be a matter of calling that categories relatedTo param using each Month Category ID.
{% set monthIds = craft.categories.group('months').ids() %}

{% for monthId in monthIds %}
    
        {# group each months entries #}
        {% for item in craft.entries.section('sectionName').relatedTo({targetElement:monthId}) %}
            {# content for each entry. #}
        {% endfor %}
    
{% endfor %}

Two you could use your eventStart field.
{# 1 == January #}
{% set months  = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"] %}
{% for month in 1..12 %}
    
        {# group each months entries #}
        {% set idx = month - 1%}
        {{ months[idx] }}
        {% for item in craft.entries.section('blog') if item.eventStart|date("n") == month %}
            {# content for each entry. #}
            {{item.title}}
        {% endfor %}
    
{% endfor %}

> **Comments:**
> **username_0**: Thank aran for the codes. I tried the last option you provided. It works perfectly but it repeat the word Month twelve times Month 1, Month 2 etc. How to use the month name instead? (Jan, Feb etc) do I have to create array name like 1 = Jan, 2 = Feb etc?  
> **username_1**: I have updated the answer to help you with that.  
> **username_0**: Thank for the update. I test it and return error Internal Server Error  Unexpected character "#".  
> **username_1**: I have updated the answer it was missing closing brackets for month name.  

---

