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 %}

1 Answer 1

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 and acknowledge you have read our privacy policy.

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