7

How can I conditionally display content if its a specific section?

Currently I'm trying this with no luck:

{% if entry.section == 'lettings' %}{{ entry.rentFrequency.label }}{% endif %}
10

You're close!

SectionModel has 'name' and 'handle' attributes and one of those is probably what you're looking for.

{% if entry.section.handle == 'lettings' %}
    {{ entry.rentFrequency.label }}
{% endif %}

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.