Advertisement
Guest User

Untitled

a guest
Feb 19th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. {% set monthIds = craft.categories.group('months').ids() %}
  2.  
  3. {% for monthId in monthIds %}
  4. <div>
  5. {# group each months entries #}
  6. {% for item in craft.entries.section('sectionName').relatedTo({targetElement:monthId}) %}
  7. {# content for each entry. #}
  8. {% endfor %}
  9. </div>
  10. {% endfor %}
  11.  
  12. {# 1 == January #}
  13.  
  14. {% for month in 1..12 %}
  15. <div>
  16. <h2>MONTH {{ month }}</h2>
  17. {# group each months entries #}
  18. {% for item in craft.entries.section('blog') if item.postDate|date("n") == month %}
  19. {# content for each entry. #}
  20. <h3>{{item.title}}</h3>
  21. {% endfor %}
  22. </div>
  23. {% endfor %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement