Flexible Content Loop#
{{ sections }} {{ partial src="sets.home.{set}" }}{{ else }} <p>No sections.</p>{{ /sections }}TemplateX uses the current row layout to replace {set}.
If the row layout is hero, the example above looks for a matching partial such as:
- hero.php
Set Partials#
Set partials use the current ACF row as their context:
<section data-set="{{ set }}"> <h2>{{ title }}</h2> <img src="{{ image }}" alt="{{ image.alt }}"></section>Inside a set partial, {{ set }} is the current row layout, and fields such as {{ title }} and {{ image }} come from the flexible content row.
Nested Flexible Content#
Nested flexible content inside a set partial stays in the current row context:
{{ cards }} {{ partial src="sets.cards.{set}" }}{{ /cards }}Use this when flexible content rows contain smaller flexible content areas.