Frequently Asked Questions

Updated 07 May, 2022

Here's a list of the most frequently asked questions about Advanced Custom Fields extension

How to hide a custom field from the category view?

If you're looking for a reliable way to prevent a Joomla Custom Field from being rendered on the List/Category view and display it only in the article's page, follow the steps below:

From the menu go to Content -> Fields, click to edit your field to open its settings page. If you're using the Pro version you will be able to see a new tab called Display Conditions.

If the Display Conditions tab is not available, make sure you're using Advanced Custom Fields Pro and the Display Conditions option found in the extension settings is enabled.

Scroll at the very bottom where you can find the PHP Assignment. Set it to Include and enter the following PHP snippet.

return $app->input->get('view') == 'article'

How to Use Advanced Custom Fields on J2Store

J2Store doesn't support out of the box the Joomla! custom fields and as a result Advanced Custom Fields too.

However, J2Store has taken care of this via their extension/app called Content custom fields. It's a free app which once you download and head over to your Joomla! site and install it you should be able to use all of Joomla! core fields as well as you Advanced Custom Fields.

They have provided a guide on how to set it up on their documentation page on how to configure Content custom fields

How to load article's custom fields with PHP?

In order to get article's custom fields programmatically with PHP use the code below:

$article_id = 5; // Enter your article ID here

$model = JModelLegacy::getInstance('Article', 'ContentModel');
$article = $model->getItem($article_id);

JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');
$fields = FieldsHelper::getFields('com_content.article', $article, true);

The $fields variables is an Array of Objects and you can loop through it like in the example below:

foreach ($fields as $key => $field)
{
    echo $field->title . ' = ' . $field->rawvalue;
}

Can I use Advanced Custom Fields with YooTheme Pro & Dynamic Content?

Any custom field you may have created and have set value in your articles will automatically appear in your pages that are set to display using the YooTheme Template. YooTheme is a template that works on-top of Joomla Articles and thus respects Advanced Custom Fields, being an extension of the Joomla core fields.

The Dynamic Content feature that YooTheme Pro provides, is a way to load custom fields values from an Article, Category or User to the "Elements" that you use to populate your page. The Elements that YooTheme Pro provides require their own format in order to appear correctly on the front-end. Each custom field may provide a different value than the one required by YooTheme Pro elements and thus some custom fields may not work out of the box.