For the complete documentation index, see llms.txt. This page is also available as Markdown.

Displaying custom fields in the Gutenberg editor

Using Layouts from Advanced Views, you can display any custom fields in the Gutenberg editor. Smart templates give you complete control over the markup and display logic without extra hassle.

1. How to display custom fields on a single page

In Advanced Views, Layouts are embedded using native WordPress shortcodes, which you can paste in any place in the Gutenberg editor:

  1. Add target fields in the Fields tab and save the Layout

  2. Open the target page or post

  3. Within Gutenberg: Click on the plus and add a Shortcode block

  4. Within the Shortcode block: Paste the Layout embedding shortcode

  5. Save the page and visit it to see the result

To change the default field appearance, open the created Layout and customize the Layout template.

2. How to display custom fields in a Template

Block themes (all default WordPress themes, like Twenty Twenty-Five) also use Gutenberg for the Site Editor management. Using Advanced Views, you can display custom fields in any theme location.

2.1) Custom Post Type template

If multiple pages or Custom Post Type (CPT) items share the same set of custom fields, you don't need to embed a Layout in each item individually. Instead, embed the Layout in the appropriate template so it is rendered automatically for every corresponding item:

  1. Add target fields in the Fields tab and save the Layout

  2. Open the Site Editor (Dashboard → Appearance → Editor).

  3. Choose any Template (or add a new one for CPT items)

  4. Within the Template: click on the plus and add a Shortcode block

  5. Within the Shortcode block: Paste the Layout embedding shortcode

  6. Save the template and visit any CPT item to see the result

When the template is rendered, the embedded Layout automatically displays the custom fields for the current page, post, or other content item using that template.

In block themes, the Header and Footer are template parts managed from the Patterns section of the Site Editor. A common use case is displaying custom fields from an Options page in the site footer.

To do this, simply embed a Layout in the Footer template part, and its content will be rendered automatically across the entire site.

  1. Add target fields in the Fields tab and save the Layout

  2. Modify Layout shortcode: add object-id="options" argument (to display fields from the Options page)

  3. Open the Site Editor (Dashboard → Appearance → Editor).

  4. Click PatternsHeader (or Footer) tile

  5. Within the Template: click on the plus and add a Shortcode block

  6. Within the Shortcode block: Paste the Layout embedding shortcode

  7. Save the pattern and visit any page to see the result

Unlike page-specific custom fields, custom fields from an Options page are site-wide. As a result, the same values are displayed on every site page.

3. How to display custom fields in the Query Loop block

By default, the Query Loop block can display only native WordPress fields from the queried posts. By using Layouts, you can not only display custom fields within any Query Loop, but also add conditions, merge fields, and modify field value output.

  1. Add target fields in the Fields tab and save the Layout

  2. Open the target page with the Query Loop block

  3. Within the Query Loop block: click on the Post Template element

  4. Within Post Template: click on the plus and add a Shortcode block

  5. Within the Shortcode block: Paste the Layout embedding shortcode

  6. Save the page and visit it to see the result

The Post Template inside the Query Loop is rendered for each found post, while the Layout displays the custom fields for that specific post.

Last updated