Created
February 18, 2014 15:56
-
-
Save dustinwalker/9073679 to your computer and use it in GitHub Desktop.
Find tags in given tag group, list tags and entries under each tag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# | |
# FIELD_NAME is name of field | |
# sampleCategories, sampleCategory, category, entry, entries can be anything | |
#} | |
{% set sampleCategories = craft.tags.set('FIELD_NAME') %} | |
<ul> | |
{% for sampleCategory in sampleCategories %} | |
{% set category = craft.tags.search('name:'~sampleCategory.name).first() %} | |
{% if category %} | |
<li> | |
<h2>{{ category }}</h2> | |
{% set entries = craft.entries.parentOf(category).find() %} | |
<ul> | |
{% for entry in entries %} | |
<li>{{ entry.title }}</li> | |
{% endfor %} | |
</ul> | |
</li> | |
{% else %} | |
{% exit 404 %} | |
{% endif %} | |
{% endfor %} | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment