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:
If you assigned a Layout to your custom field (option introduced in Joomla 3.9), Articles Anywhere will account for it and output the field using that layout (without the 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:
While to individually output only the label of the field:
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:
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
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:
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:
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 will output the text part of the values.
For instance, the "Habitat Area" field is a list field that has option texts
Europe with respectively option values
eu. Let's say the second option is selected for the current article. Then
[habitat-area] will output:
But if you want to instead output the raw value as saved in the database, you can use the
output="value" attribute This will make it output the option values instead of the texts.
[habitat-area] => Asia
[habitat-area output="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 raw value as saved in the database, 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. You can use
output='value' with single quotes to avoid problems with the editor messing up your syntax:
<div class="habitat-[habitat-area output='value']">[habitat-area]</div>
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=" - "]
In addition to the Field Layout, Articles Anywhere for Joomla 3 also allows you to customize the output specifically related to the "value" part of a custom field.
This can come especially useful if you need further control on custom field types that have multiple values (like lists, checkboxes and multi-select fields).
Check out the dedicated guide and example on how to create a Value Layout.
Once created, you can pass the name of your custom file to the data tag with a
Or use the full path to the layout file:
Note: Value Layouts are only available in the Joomla 3 version of Articles Anywhere, as the Joomla 4 version handles things differently.