1

I couldn't find this anywhere so I thought I would post the answer. How do you limit the output of a navigation element to a specific entry type.

This question is explicitly for the navigation element - I only want to show a specific entry type in a navigation element.

1

1 Answer 1

1

Both of these work:

{% set sectionNamePages = craft.entries.section('sectionName').type('entryTypeA').level(1) %}
{% for page in sectionNamePages %}
    <li class="{{ page.id == entry.id ? 'active' }}">{{ page.getLink() }}</li>
{% endfor %}


{% set sectionNamePages = craft.entries.section('sectionName').level(1) %}
{% for page in sectionNamePages.type('entryTypeA') %}
    <li class="{{ page.id == entry.id ? 'active' }}">{{ page.getLink() }}</li>
{% endfor %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.