Custom Fields Usage

Custom fields are used to show editable information on your website pages.

Impreza has built-in custom fields, like the "Page Layout" box. To create your own additional fields use the Advanced Custom Fields plugin.

How to show Custom Field values in theme elements #

Some theme elements may use dynamic values via {{custom_field_name}} shorthand. Dynamic value takes the value from a custom field of the current post (page, product, etc.). If the custom field doesn't exist, then returns an empty string.

The {{custom_field_name}} shorthand allows to output text values only. All HTML tags will be stripped, that's why it's not possible to output images and other complex content.

For example, the Real Estate demo has the following ACF fields:

2589.png

If you add the Text element with the following

{{storeys}}-storey house with living area of {{living_area}} sqm, with {{bedrooms}} bedrooms, located on a plot of {{land_area}} sqm.

text into the "House Page" Content template:

2590.png

After that every house page will display values from its custom fields, like:

2591.png

Elements with dynamic values support #

  • Accordion (Section Title field)
  • ActionBox (Title, Buttons Label fields)
  • Button (Button Label field)
  • Contact Info (all fields)
  • Counter (Final counting value, Title fields)
  • Dropdown (Title field)
  • FlipBox (Title, Description, Button Label fields)
  • IconBox (Title field)
  • Interactive Banner (Title, Description fields)
  • Map (Custom address, Marker Text fields)
  • Person (Name, Role fields)
  • Pricing Table (all fields)
  • Progress Bar (Progress Value, Final Value, Title fields)
  • Separator (Title field)
  • Social Links (Enter the URL field)
  • Tabs/Vertical Tabs (Section Title field)
  • Text (Text field)
  • Video Player (Link field)
  • Display Logic > Page URL > Value field in all theme-related elements
  • Display Logic > Cart Total > Value field in all theme-related elements
  • Design > Extra class field in all theme-related elements

Values from the ACF Options page #

If you have the enabled ACF Options Page you can get its values with the "option|" prefix, like {{option|field_name}} shortcode.

Predefined dynamic values #

These values are not custom fields and will work in any context:

  • {{the_title}} - shows the title of the current page
  • {{comment_count}} - shows comments amount of the current post (reviews amount of a WooCommerce product)
  • {{post_count}} - shows the total amount of published posts
  • {{user_count}} - shows the total amount of registered users