You can display the value of any custom field of an article using the name of that specific field.

Let's say you want to ouput the custom field "Habitat" - that has a field name / alias habitat-area. You can simply do:

{article title="Lions"}[habitat-area]{/article}

If you assigned a Layout to your custom field, Articles Anywhere will account for it and output the field using that layout (without the label).

Field Label

By default, the label of the field will not be shown.

To also output the label along with the value of the field, like "Habitat: Africa", you can do:

[habitat-area showlabel="true"]

Or if you want the output of the label to depend on what you've set in the "Show Label" setting in the field options, you can use:

[habitat-area showlabel="inherit"]

While to individually output just the label of the field, you can use the dedicated label suffix below:

[habitat-area:label]

Alternative Layout

By default, Articles Anywhere will use the Layout assigned to that custom field in its Render Options. However, in the data tag you are able to override the default layout with a different one.

If you are not familiar with layout overrides, check out the dedicated tutorial on How to create an Alternate Layout for Custom Fields in Joomla.

To give you a short overview, the default layout used to render a custom field is located at this path:

/components/com_fields/layouts/field/render.php

You can use this default file as your starting base, copy this file to templates/[my template]/html/layouts/com_fields/field/my-layout-name.php, and edit the code to meet your needs.

Now, in the data tag, you can set to use the alternative layout by simply inserting the name of the file in the layout="..." attribute:

[habitat-area layout="my-layout-name"]

On the other hand, If your custom field already has an alternate layout assigned in the core option, but you want to display it with the default layout (render.php) in Articles Anywhere, you can do:

[habitat-area layout="default"]

Plain text & Raw values

If you would like to output just the value of the field without the field layout, so without any HTML markup around it, you can use [habitat-area:text], or also:

[habitat-area layout="false"]

For certain custom field types, the custom field value gets stored differently in the database compared to how it's displayed on the site.

For example, in field types that can have multiple values (such as lists and checkboxes), for each option you can enter the option "Text" and its option "Value". Normally, the custom field layout will output the text part of the values.

For instance, the "Habitat Area" field is a list field that has option texts Africa, Asia and Europe with respectively option values af, as and eu. Let's say the second option is selected for the current article.

Then, [habitat-area:text] would output: Asia. But If you want to instead output the raw value as saved in the database, you can use the value suffix. This will make it output the option values instead of the texts.

[habitat-area] => <span class="field-value">Asia</span> (through field layout)
[habitat-area:text] => Asia
[habitat-area:value] => as

The Raw value can also be very useful if you want to output the value of a field as part of an HTML class - as it will output just the value without the field layout, so without any HTML markup around it.

Here is an example of how you could use both the name and value of the custom field - using the raw value as a class name:

<div class="habitat-[habitat-area:value]">
    [habitat-area]
</div>
<div class="habitat-as">
    <span class="field-value">Asia</span>
</div>

Separator for multiple values

When using custom field types that can have multiple values (like lists, checkboxes and articles), the values will be normally output separated by a comma, like:

Africa, Asia, Europe

But you have the ability to change the separator to something else, by using a separator="..." attribute inside the data tag. For instance:

[habitat-area separator=" - "]
Africa - Asia - Europe

You can also add last-separator="..." to use a different separator in between the last 2 elements:

[habitat-area separator=", " last-separator=" and "]
Africa, Asia and Europe

For even more control over the Value Layout of List Fields, you can use the Foreach Structure feature.

Subform Field J4

The subform is a new Custom Field type in Joomla 4, which is an evolution and expansion over the former "Repeatable Field" of Joomla 3. The Subform Field allows you to create a "parent field" which contains a repeatable set of sub-fields.

Of course, with Articles Anywhere you can normally output the complete Subform Field through its layout, by simply using [name-of-the-subform].

But Articles Anywhere also allows you to control which sub-fields you want to display from each of the rows of the Subform field, thanks to the new Foreach Structure feature.

Read: Using the Foreach Structure to output sub-fields of the Subform Field.

List of Data Tags J4

Check out below the Full List of Data Types available for every Custom Field at your disposal.

SyntaxExampleDescription
habitat-area Asia

The rendering of a custom field via its field layout, without the label.
Note: When used in Filters, Ordering and If Structures, this will use the rawvalue.

habitat-area:text Asia Only the text value of a custom field, without any html markup around it.
habitat-area:value as The rawvalue of a custom field, without any html markup around it.
habitat-area:label Habitat The label of a custom field.
habitat-area:title Habitat Area The title of a custom field.
habitat-area:name habitat-area The name/alias of a custom field.
habitat-area:id 123 The ID of a custom field.
habitat-area:type
habitat-area:description
list The type, description, or any other data attached to the field. It must match the name of the columns available in the database (you can replace the underscores with dashes).
habitat-area:render_class
habitat-area:prefix
habitat-area:suffix
etc.
... Any attribute related to the field "Options". It must match the attribute name in the params or fieldparams database column (you can replace the underscores with dashes).

Output Field by ID, Title or Label J4

If instead of using the name (alias) of the custom field, you would like to output a field based on its ID, Title or Label, you can do that by using the field prefix. Any of these will also work:

SyntaxDescription
[field:5]

Output a custom field based on the ID, where the ID is 5

[field:habitat-area]

Output a custom field based on the Title, where the Title is "Habitat Area"

[field:habitat]

Output a custom field based on the Label, where the Label is "Habitat"

Everything else works the same way as explained above for the syntax used with the field name / alias. For example:

[field:5 showlabel="true"]
[field:5 layout="habitat-field"]
[field:5:value]
[field:habitat-area:label]

The syntax with the  field: prefix also comes useful if your custom field name is called the same as a reserved attribute key already used by Articles Anywhere (for example in case of a custom field called  category or  type ).

In this case, you can output your custom field with:

[field:category]

Adding or overriding attributes J4

Just like you can override the showlabel and layout attributes as we've seen above, you can control the output of the custom field by adding or setting extra attributes inside the data tag.

You can override any of the Render Options or parameters of a custom field. For example, to output a field with a different label, you can do:

[habitat-area label="My Custom Label"]

Or to change the render class of a field display, you could use render_class="my-custom-class".

Here are some of the attributes you can override (you can optionally replace the underscores with dashes)::

SyntaxDescription
layout Choose an alternate layout for the field
label The label of the field to display
showlabel Whether to show the label or not (default is false)
render_class The class of the field in the output
label_render_class The class of the label in the output
prefix The field prefix
suffix The field suffix
image_class
showtime
custom_html
etc.
Any type-specific attribute of the field. It must match the attribute name in the fieldparams database column (you can replace the underscores with dashes).

Field Groups J4

You can also output an entire Field Group of the article, which will be rendered via the Joomla core layout:

SyntaxDescription
[fieldgroup:5] The full output of a fieldgroup based on the ID
[fieldgroup:5:title] The title of a fieldgroup based on the ID.
[fieldgroup:5:description] The description of a fieldgroup based on the ID.
[fieldgroup:product-information] The full output of a fieldgroup based on the Title, where the Title is "Product Information"
[fieldgroup:product-information:description] The description of a fieldgroup based on the Title, where the Title is "Product Information"

Field Group Alternative Layout

In a similar way to Fields Layouts described above, Articles Anywhere also allows you to set a different layout for Field Groups.

The default layout used to render field groups is located at this path:

/components/com_fields/layouts/fields/render.php

You can use this default file as your starting base, copy this file to templates/[my template]/html/layouts/com_fields/fields/my-layout-name.php, and edit the code to meet your needs.

Now, in the data tag, you can set to use the alternative layout by simply inserting the name of the file in the layout="..." attribute:

[fieldgroup:5 layout="my-layout-name"]