# Advanced title and Content fields

{% embed url="<https://youtu.be/CSL7HN337j8>" %}

Advanced title and content fields editor is used to add various fields, such as custom field values, taxonomy terms list, WooCommerce Add To cart, Price, Star rating and many different result fields.

The advanced field editors can be found under the `Advanced Options -> Content & Fields` panel.

<figure><img src="https://1706764988-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9jkFgNo4lpUof35gvS%2Fuploads%2FB5JuNXoRfLPrYqTK8LYP%2Fimage.png?alt=media&#x26;token=84872933-e9a5-425c-a226-d00cd20eb306" alt="" width="169"><figcaption></figcaption></figure>

{% hint style="info" %}
Most of these use cases are explained in detail in the video above. For special cases not covered in the video, please read below.
{% endhint %}

### Conditional Brackets

<figure><img src="https://1706764988-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9jkFgNo4lpUof35gvS%2Fuploads%2F2omhopXlGqK67TJ9M68g%2Fimage.png?alt=media&#x26;token=e18aca50-9ca4-41cd-9f8a-b3d0d84f230d" alt=""><figcaption></figcaption></figure>

The square brackets aka `[` and `]` represent a conditional wrapper. Whatever is wrapped within these brackets is considered conditional, meaning:

* If any of the field values is empty, everything within the conditional is returned as empty
* You can use any number of fields in the conditionals
* You can use any text or HTML within the conditionals

#### Practical example

Say you have a field name "text\_field", which may not be assigned to all of the results. You want to display the field value such as:

*My field: **{field value here}***

The issue is, that when a result has no "text\_field", the following text will be displayed:

*My field:*

By using conditionals, you can wrap the field and the preceeding text with the conditional, to avoid printing the "*My field:"* text when the "text\_field" is empty.

<figure><img src="https://1706764988-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9jkFgNo4lpUof35gvS%2Fuploads%2F01pZH5yBRT0DWCM9qpZ7%2Fimage.png?alt=media&#x26;token=521ea758-10e3-4c03-ac0b-c47d0b465924" alt=""><figcaption><p>Inserting my_rfield</p></figcaption></figure>

<figure><img src="https://1706764988-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9jkFgNo4lpUof35gvS%2Fuploads%2FaoEB0YGx2d9sAtXMwzz8%2Fimage.png?alt=media&#x26;token=8f47b547-d979-49a2-bda2-e2bd2b2c48b8" alt=""><figcaption><p>Adding the "My field:" text and the conditional wrappers</p></figcaption></figure>

### Using Shortcodes in Advanced Title or Content Fields

Because the square brackets are used for conditional brackets, using shortcodes is possible via **double square** brackets.

To use a shortcode `[my_shortcode]` in the field, the brackets have to be doubled so it becomes `[[my_shortcode]]`

{% hint style="warning" %}
Shortcodes should not be used within [conditional brackets](#conditional-bracket-examples). The shortcode contents are executed after the conditional brackets are evaluated, therefore they don't have any effect on the conditionals.
{% endhint %}

#### Using my\_shortcode in a paragraph block

<pre><code><strong>&#x3C;p>[[my_shortcode]]&#x3C;/p>
</strong></code></pre>

#### Using a shortcode with an opening and closing tag

```
[[shortcode_with_closing_tag]]Shortcode Content[[/shortcode_with_closing_tag]]
```

#### Using nested shortcodes within a div element

```
<div>
[[nested_shortcodes]]
    [[single_shortcode]]
[[/nested_shortcodes]]
</div>
```
