Adding ACF fields inside pages

Estimated reading time: 3 min

Advanced Custom Fields (ACF) lets you attach your own fields to pages, posts, products or terms. Rey can then display those fields on the front end, and there are five ways to do it. This article explains which one to pick, and how each works.

Before you start: create the fields

Nothing below works until the fields exist. Rey already ships ACF PRO for its own settings, so the plugin does not have to be installed separately: open ACF → Field Groups in your WordPress admin and create a group holding the fields you need. In the group’s Location rules you decide where those fields appear: on all products, on one page, on a category, and so on.

The ACF "Field Groups" screen with one group open, showing a couple of fields and the Location rules box underneath.

ACF has plenty of field types and display conditions. Their own guide to creating a field group covers it better than we could, and there are plenty of video tutorials on YouTube as well.

Note: No ACF menu in your admin sidebar? It can be hidden from Rey Theme → Settings → Advanced → Admin → Show the ACF admin menu. Turn it back on and the menu returns.

Which method should you use?

  • Building the page with Elementor and the field is its own element (a title, a paragraph, an image, a button, a table): use Rey’s ACF Fields widgets. This is the shortest route and the one to try first.
  • The field’s value has to go inside an existing widget, for example as a heading’s text or a button’s link: use Rey’s Dynamic Tags.
  • The field has to show on a page you cannot open in Elementor, such as a product page, the shop or an archive: use a Global Section, or a Custom Template.
  • You only need the raw value dropped into some text, with no styling: use ACF’s own shortcode.
  • You own an Elementor PRO license: its own Dynamic Tags work too, and are an equally good choice.

1. Rey’s ACF Fields widgets for Elementor

Rey adds a group of Elementor widgets that render a field’s value directly. In the Elementor editor, look for the ACF Fields category in the widgets panel. It contains five widgets:

  • Text and Heading for text fields;
  • Image for image fields;
  • Button for link or URL fields;
  • Table, which prints a group of fields as rows.

Drop one in, then pick your field from its Field dropdown. Everything else is normal Elementor styling.

The Elementor widgets panel with the "ACF Fields" category expanded, showing the five widgets

Note: These widgets come from the ACF Fields for Elementor module. If the category is missing, open Rey Theme → Modules and make sure that module is enabled.

The catch is that they only exist where Elementor does, so on a page or post you built yourself. Product pages, archives and the shop page are generated by WooCommerce and cannot be opened in Elementor, which is what the next two methods are for.

2. Rey’s Dynamic Tags

When the value belongs inside a widget you already have, use a dynamic tag instead of a separate widget. Click the small database icon next to a control in Elementor, pick Advanced Custom Fields, then choose your field. The control now prints whatever that field holds on the page being viewed.

This works for text, links, images and a few other control types. See Dynamic Tags for Elementor for the full list and how they behave.

Rey ACF dynamic tags

3. Through a Global Section, on pages you cannot edit with Elementor

Product pages, category archives and the shop page are generated by WooCommerce, so there is no Elementor canvas to drop a widget onto. The way around it is to build the piece once, as a Generic Global Section, using the same ACF widgets, and then inject that section where you need it.

Every Global Section has a shortcode you can paste anywhere:

[[rey_global_section id="123"]]

On a product page, the useful places to paste it are:

  • the product’s short description, or its main description;
  • before or after the Add to cart button, in Rey Theme → Settings → WooCommerce → Product Page → Summary Components → Before / After Add to cart (Content). There is a whole article on this: Add content before or after the Add to cart button;
  • inside one of the product’s information tabs or blocks, in Rey Theme → Settings → WooCommerce → Product Page → Tabs & Blocks;
  • as a whole section under the product summary, in Rey Theme → Settings → WooCommerce → Product Page → Page Components → Global Sections. Here you pick the section from a dropdown, so no shortcode is needed.
Theme Settings open at WooCommerce → Product Page → Page Components → Global Sections, with a section picked in the "After product summary" dropdown.

If you are going to customise more than one or two spots, stop patching and build the whole page instead: see Custom Templates, which gives you the product page as an Elementor canvas, ACF widgets included.

4. ACF’s own shortcode

ACF ships a shortcode that prints a field’s raw value, with no markup and no styling around it. It is the quickest option when the value has to sit inside a sentence:

[acf field="field_name"]

Add post_id="123" to read the field from a specific post instead of the one being viewed. The parameters are documented in ACF’s shortcode reference.

5. Elementor PRO’s Dynamic Tags

If you already own an Elementor PRO license, its own ACF integration does the same job as Rey’s dynamic tags and is just as good a choice. Elementor documents it in Elementor and ACF.

You do not need Elementor PRO for any of the other four methods.

Was this article helpful?