Advanced Custom Fields

The Loop and Field tags support the following ACF field types.

Basic

Content

Date

Choice

Relational

Nested

Fields from options page


Field types

Basic fields

These field types can be displayed simply with the Field tag.

  • Text
  • Textarea
  • Number
  • Email
  • URL
  • Password

Content fields

WYSIWYG editor

Use the acf_editor attribute.

<Field acf_editor=field_name />

OEmbed

Use the acf_oembed attribute.

<Field acf_oembed=field_name />

Template

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 />

Date fields

Date and date-time picker

Use the acf_date or acf_date_time attribute.

<Field acf_date=field_name />
<Field acf_date_time=field_name />

Date format

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.

Choice

Select

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>

Checkbox

Use the Loop tag and acf_checkbox attribute.

<Loop acf_checkbox=field_name>
  <Field />
</Loop>

Radio

Use the acf_radio attribute.

<Field acf_radio=field_name />

Choice labels

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>

Choices

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.

Relational

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 />

File

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.

Image

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.

Link

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.

Post object

Use the acf_post attribute.

<Loop acf_post=field_name>
  <Field title />
</Loop>

See Post Loop for available fields.

Relationship

Use the acf_relationship attribute.

<Loop acf_relationship=field_name>
  <Field title />
</Loop>

See Post Loop for available fields.

Taxonomy

Use the acf_taxonomy attribute.

<Loop acf_taxonomy=field_name>
  <Field title />
</Loop>

See Taxonomy Term Loop for available fields.

Gallery

Use the acf_gallery attribute.

<Loop acf_gallery=field_name>
  <Field title />
</Loop>

See Attachment Loop for available fields.

Nested

Repeater

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.

Flexible content

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.

Layout

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>

Group

Use the acf_group attribute.

<Loop acf_group=field_name>
  <Field title />
</Loop>

Fields from options page

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.