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:

  1. Log into your backend.
  2. Go to Content -> Fields, and click to edit your field.
  3. Go to the Display Conditions tab.
  4. Click Add Condition.
  5. Select the Content Component View option in the top left dropdown.
  6. Set the Match option to Is
  7. Select Single Article in the Component Component View option.

Your settings should look like this:

acf_show_field_only_in_article.png

If the Display Conditions tab is unavailable, ensure you're using Advanced Custom Fields Pro, and that the Display Conditions option in the extension settings is enabled.

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

Last updated on Oct 29th 2024 14:10