> For the complete documentation index, see [llms.txt](https://wplake.gitbook.io/advanced-views/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wplake.gitbook.io/advanced-views/integrations/page-builders/oxygen/displaying-custom-fields.md).

# Displaying custom fields in Oxygen

Using [*Layouts*](/advanced-views/getting-started/first-layout.md) from Advanced Views, you can display any custom fields in [Oxygen](https://oxygenbuilder.com/), including both [Oxygen](https://oxygenbuilder.com/) (v6+) and [Oxygen Classic](https://classic.oxygenbuilder.com/). Smart templates [give you complete control](/advanced-views/getting-started/key-aspects.md) over the markup and display logic without extra hassle.&#x20;

{% hint style="success" %}
Advanced Views natively supports fields from multiple providers:

1. [WordPress fields](/advanced-views/fields/wordpress-fields.md) (like page title, excerpt, user name, etc)
2. [Advanced Custom Fields](/advanced-views/fields/meta-plugins/advanced-custom-fields.md) (any field type)
3. [MetaBox fields](/advanced-views/fields/meta-plugins/meta-box-fields.md) (any field type)
4. [Pods fields](/advanced-views/fields/meta-plugins/pods-fields.md) (any field type)
5. [WooCommerce Product fields](/advanced-views/fields/woo-product-fields.md) (like price, SKU, height, etc)

To display [other fields](/advanced-views/fields/other-fields.md) made by your theme or plugins, just [customize the default Layout template](/advanced-views/layouts/code-fields/custom-template.md).
{% endhint %}

## 1. How to display custom fields on a single page

{% hint style="info" %}
The steps below apply to the Oxygen editor. If you edit pages using the Gutenberg editor, refer to our [Gutenberg editor guide](/advanced-views/integrations/editors/gutenberg/displaying-custom-fields.md) instead.
{% endhint %}

<figure><img src="https://2293383029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FN2nAC4pTDjEmDu8ZkLB2%2Fuploads%2Fp7ByUeQmabOC6GQ1eY1t%2Foxygen.png?alt=media&amp;token=9988f887-2432-47e0-9a71-dc12600a1684" alt=""><figcaption></figcaption></figure>

In Advanced Views, *Layouts* are embedded using native WordPress shortcodes, which you can paste anywhere in the Oxygen editor:&#x20;

1. [Create a *Layout*](/advanced-views/getting-started/first-layout.md)
2. Add target fields in the *Fields* tab and save the *Layout*
3. Copy a [Layout embedding shortcode](/advanced-views/layouts/embedding-shortcode.md)
4. Edit the target page with Oxygen
5. **Within the editor**: Click on the plus and add a [Shortcode element](https://oxygenbuilder.com/documentation/reference/elements/advanced/shortcode/)
6. **Within the Shortcode element**: Paste the *Layout* embedding shortcode
7. 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](/advanced-views/layouts/code-fields/custom-template.md).&#x20;

{% hint style="success" %}
By default, *Layout* displays chosen fields of the current page. You can display fields from other sources by tuning the [Layout shortcode arguments](/advanced-views/layouts/embedding-shortcode.md).&#x20;
{% endhint %}

## 2. How to display custom fields in a Component

[Components](https://oxygenbuilder.com/documentation/design/components/) are reusable Oxygen elements that can be used, for example, as item templates in the [Post Loop Builder](https://oxygenbuilder.com/documentation/reference/elements/dynamic/post-loop-builder/). Unlike pages, Components must have a single root container, with all other elements nested inside it.

<figure><img src="https://2293383029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FN2nAC4pTDjEmDu8ZkLB2%2Fuploads%2FaK2IJ8x71ZGO2lTZR24E%2Foxygen-components.png?alt=media&amp;token=5e55e43d-a563-4f5e-a2bb-f2c7cf039dcb" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2293383029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FN2nAC4pTDjEmDu8ZkLB2%2Fuploads%2FLc7gVKHsPH9AHLS9fgrQ%2Foxygen-component.png?alt=media&amp;token=0a91fff8-8af7-415d-b9ec-f3fd8a1616fc" alt=""><figcaption></figcaption></figure>

1. [Create a *Layout*](/advanced-views/getting-started/first-layout.md)
2. Add target fields in the *Fields* tab and save the *Layout*
3. Copy a [Layout embedding shortcode](/advanced-views/layouts/embedding-shortcode.md)
4. Open the [Oxygen Components](https://oxygenbuilder.com/documentation/design/components/) (Dashboard → Oxygen → Components)
5. Choose any Component (or add a new one)
6. **Within the editor**: Click on the plus and add a [Shortcode element](https://oxygenbuilder.com/documentation/reference/elements/advanced/shortcode/)
7. **Within the Shortcode element**: Paste the *Layout* embedding shortcode
8. Save the component (and optionally, assign the Component as a [Post Loop Builder](https://oxygenbuilder.com/documentation/reference/elements/dynamic/post-loop-builder/) item template)
9. Visit the target page with the component to see the result

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

{% hint style="success" %}
By default, *Layout* displays chosen fields of the current page. You can display fields from other sources by tuning the [Layout shortcode arguments](/advanced-views/layouts/embedding-shortcode.md).&#x20;
{% endhint %}

## 3. How to display custom fields in a Template

### 3.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 [Oxygen template](https://oxygenbuilder.com/documentation/templating/template-basics/), so it is rendered automatically for every corresponding item:

<figure><img src="https://2293383029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FN2nAC4pTDjEmDu8ZkLB2%2Fuploads%2FkO7VoisDvIt8UWEcr7Qs%2Foxygen-templates.png?alt=media&amp;token=7fd54f22-b1c1-4f22-9130-81d773ccbb36" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2293383029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FN2nAC4pTDjEmDu8ZkLB2%2Fuploads%2FB0ntqAK4SOs6bVSwqeDq%2Foxygen-template.png?alt=media&amp;token=c4b31ae4-ad6d-4b74-ae6d-1ea7542be169" alt=""><figcaption></figcaption></figure>

1. [Create a *Layout*](/advanced-views/getting-started/first-layout.md)
2. Add target fields in the *Fields* tab and save the *Layout*
3. Copy a [Layout embedding shortcode](/advanced-views/layouts/embedding-shortcode.md)
4. Open the [Oxygen Templates](https://oxygenbuilder.com/documentation/templating/template-basics/) (Dashboard → Oxygen → Templates)
5. Choose any Template (or add a new one for CPT items)
6. **Within the editor**: Click on the plus and add a [Shortcode element](https://oxygenbuilder.com/documentation/reference/elements/advanced/shortcode/)
7. **Within the Shortcode element**: Paste the *Layout* embedding shortcode
8. 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.

{% hint style="success" %}
*Layout* IDs are unique string identifiers, not WordPress post IDs. Unlike post IDs, they remain unchanged when *Layouts* are exported and imported, ensuring consistent references across different environments, such as staging and production.
{% endhint %}

### 3.2) Header/Footer template

{% hint style="info" %}
A common use case is [displaying custom fields from an Options page](/advanced-views/field-sources/options-page.md) in the site footer.&#x20;
{% endhint %}

In Oxygen, Header and Footer templates are edited similarly to plain templates. The main difference in this integration is the shortcode modification: you need to add the `object-id` argument to load fields from the Options page:

1. [Create a *Layout*](/advanced-views/getting-started/first-layout.md)
2. Add target fields in the *Fields* tab and save the *Layout*
3. Copy a [Layout embedding shortcode](/advanced-views/layouts/embedding-shortcode.md)
4. Modify the [*Layout* shortcode](/advanced-views/layouts/embedding-shortcode.md): add `object-id="options"` argument (to [display fields from the Options page](/advanced-views/field-sources/options-page.md))
5. Open the Oxygen Header/Footer page (Dashboard → Oxygen → Header/Footer)
6. Choose any item (or add a new one)
7. **Within the editor**: Click the plus icon and add a [Shortcode element](https://oxygenbuilder.com/documentation/reference/elements/advanced/shortcode/)
8. **Within the Shortcode element**: Paste the *Layout* embedding shortcode
9. Save the template and visit any page to see the result

{% hint style="info" %}
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.
{% endhint %}
