Frequently Asked Questions
Here's a list of the most frequently asked questions about the Advanced Custom Fields extension
How to show a custom field only in the Article 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 on the article's page, follow the steps below:
- Log into your backend.
- Go to Content -> Fields, and click to edit your field.
- Go to the Display Conditions tab.
- Click Add Condition.
- Select the Content Component View option in the top left dropdown.
- Set the Match option to Is
- Select Single Article in the Component Component View option.
Your settings should look like this:
How to Use Advanced Custom Fields on J2Store
J2Store doesn't support out-of-box Joomla! custom fields and, as a result, Advanced Custom Fields too.
However, J2Store has handled this via their extension/app called Content custom fields. Head over to your backend and install it; you should be able to use all of Joomla! core fields as well as 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 an article's custom fields with PHP?
To get the 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?
Of course. You can use our fields with YooTheme Pro Dynamic Content to populate YooTheme elements on your pages. We have plans to further enhance our integration by giving you access to more data for each custom field in the YooTheme Dynamic Content Dropdown list in future updates.
For more information please refer to the following page: How to use Advanced Custom Fields with YooTheme Pro Dynamic Content