Advanced Custom Fields

Fields And Groups

Simple ACF fields are read by name, and nested field values use dot paths.

Simple Fields#

If the current post has an ACF field named intro, write:

php
<p>{{ intro }}</p>

TemplateX compiles that to a native ACF field lookup in the generated PHP.

Group Fields#

ACF group fields can be read with dot paths:

php
<section>  <h2>{{ hero.headline }}</h2>  <p>{{ hero.intro }}</p></section>

If the group contains a link or image field, keep following the returned shape:

php
<a href="{{ hero.cta.url }}">{{ hero.cta.title }}</a><img src="{{ hero.image.url }}" alt="{{ hero.image.alt }}">

Field Precedence#

Built-in WordPress values win over ACF fields with the same name.

For example, {{ title }} is the WordPress title, not an ACF field named title.

Inside a repeater, relationship, gallery, or flexible content row, row values take precedence. Use parent to read from the outer post or row:

php
{{ team_members }}  <h3>{{ name }}</h3>  <p>Page: {{ parent.title }}</p>{{ /team_members }}