2

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.

5

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
| improve this answer | |

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.