The Loop
and Field
tags support the following ACF field types.
These field types can be displayed simply with the Field
tag.
Use the acf_editor
attribute.
<Field acf_editor=field_name />
Use the acf_oembed
attribute.
<Field acf_oembed=field_name />
This is for the ACF field type "Tangible Template" (under Content section) added by the plugin.
Use the acf_template
or template
attribute to render the template field.
<Field acf_template=field_name />
Use the acf_date
, acf_date_time
, or acf_time
attribute.
<Field acf_date=field_name />
<Field acf_date_time=field_name />
Optionally, use the format
and locale
attributes to apply date formatting.
<Field acf_date=field_name format="l j F Y" locale=fr />
For format syntax and available locales, see Format: Date.
Use format=default
to use the site setting from Settings -> General -> Date Format.
Use the acf_select
attribute for a field with single selected value.
<Field acf_select=field_name />
For multiple values, use the Loop
tag.
<Loop acf_select=field_name>
<Field />
</Loop>
Use the Loop
tag and acf_checkbox
attribute.
<Loop acf_checkbox=field_name>
<Field />
</Loop>
Use the acf_radio
attribute.
<Field acf_radio=field_name />
Use the acf_true_false
attribute.
<If acf_true_false=field_name>
TRUE
<Else />
FALSE
</If>
Use the Field
tag and field=label
to get the label of the chosen value.
<Field acf_select=field_name field=label />
Use the Loop
tag and field=labels
for fields with multiple values.
<Loop acf_select=field_name field=labels>
Label: <Field />
</Loop>
Use the Loop
tag and field=choices
to loop through the available choices of a field.
<Loop acf_select=field_name field=choices>
Value: <Field value /><br/>
Label: <Field label /><br/>
</Loop>
It is a list of choices with value
and label
fields.
For these field types, use the Loop
tag to get associated content.
Use the Field
tag as a shortcut to get a subfield. For example:
<Field acf_file=field_name field=title />
Use the acf_file
attribute.
<Loop acf_file=field_name>
<Field title />
</Loop>
<Field acf_file=field_name field=url />
See Attachment Loop for available fields.
Use the acf_image
attribute.
<Loop acf_image=field_name>
<Field title />
</Loop>
<Field acf_image=field_name field=url />
See Attachment Loop for available fields.
Use the acf_link
attribute.
<Loop acf_link=field_name>
<Field title />
</Loop>
<Field acf_link=field_name field=url />
Available fields are: url
, title
, and target
.
Use the acf_post
attribute.
<Loop acf_post=field_name>
<Field title />
</Loop>
See Post Loop for available fields.
Use the acf_relationship
attribute.
<Loop acf_relationship=field_name>
<Field title />
</Loop>
See Post Loop for available fields.
Use the acf_taxonomy
attribute.
<Loop acf_taxonomy=field_name>
<Field title />
</Loop>
See Taxonomy Term Loop for available fields.
Use the acf_user
attribute.
<Loop acf_user=field_name>
<Field full_name />
</Loop>
See User Loop for available fields.
Use the acf_gallery
attribute.
<Loop acf_gallery=field_name>
<Field title />
</Loop>
See Attachment Loop for available fields.
Use the acf_repeater
attribute.
<Loop acf_repeater=field_name>
<Field title />
</Loop>
All field types are supported inside a repeater loop, including another repeater field.
Use the acf_flexible
attribute.
<Loop acf_flexible=field_name>
<Field title />
</Loop>
All field types are supported inside a flexible content loop, including another flexible content field.
Use the field layout
to check which layout was chosen for each item.
<If field=layout value=layout_1>
Layout 1
<Else if field=layout value=layout_2 />
Layout 2
</If>
Use the acf_group
attribute.
<Loop acf_group=field_name>
<Field title />
</Loop>
ACF provides a function called acf_add_options_page to add options pages to store global settings.
To get fields from an options page, use the Field or Loop tag with the attribute from=options
.