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 %}
Niall Thompson
  • 1,199
  • 1
  • 11
  • 24

1 Answers1

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 %}
Brad Bell
  • 67,440
  • 6
  • 73
  • 143