Something like craft.entrytypes.section('sectionHandle')
and then loop through them to list out their names. I'm looking through the docs and can't see how to do this with just the craft.entries
code.
1 Answer
Take a look at the sections documentation: https://craftcms.com/docs/templating/craft.sections
The following code lists all entrytypes of all sections.
{% set sections = craft.sections.getAllSections() %}
{% for section in sections %}
<h2>{{ section.name }}</h2>
{% set entryTypes = section.getEntryTypes() %}
<ul>
{% for entryType in entryTypes %}
<li>{{ entryType.name }}</li>
{% endfor %}
</ul>
{% endfor %}
If you like only to show used entry types:
- Loop trough all entries
- Collect all entry types in a array
- Now, you can loop trough the entry types array