0

This snippet displays every post by postDate, which lists a bunch of “October 2015”. I am trying to filter by month/year, so only one “October 2015” shows then one “November 2015”, then one “December 2015” so on and so forth. So choosing the month, shows all posts from that month.

<div class="form-field select">
<label for="blog-date">by date</label>
<div class="custom-select">
    <select name="blog-date" id="blog-date" onchange="window.location.href=this.value;">
        <option value="/blog">All Time</option>
        {% cache %}
        {% nav entry in craft.entries({ group: 'blog', order: 'postDate desc', limit: null }) %}
            <option value="{{ entry.postDate | date('F-Y') }}"
                {% if craft.request.getLastSegment() == entry.postDate %}selected{% endif %}>
                {{ entry.postDate | title | date('F Y') }}
            </option>
        {% endnav %}
        {% endcache %}
    </select>
</div>

1

The following three resources should be substantial enough to find a solution:

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.