1

I'm using articles anywhere to load in certain articles on certain positions in my template, but the problem is is that my custom fields are not loaded in. Does anyone know how to achieve this?

1

Custom Fields in Articles Anywhere is a Pro feature, so there's the first thing you need to address.

https://regularlabs.com/extensions/articlesanywhere/tutorial#data-tags-custom-fields-pro

From there, you need to use the Custom field name to show the value of the custom field for that article.

If the custom field is called "Habitat" - that has a field name habitat_area - of article "Lions". You could put in:

{article title="Lions"}[habitat_area]{/article}

And that would then display just the custom field value from that article as there's no other field parts.

{article title="Lions"}[title] - [habitat_area]
[alltext]{/article}

This would instead display the title with the habitat after it, then the rest of the article text.

You can also just put:

{article}[habitat_area]{/article}

in the current article to put the extra field in place inside the current article.

1
  • Note you might have Articles Anywhere configured to use {} instead of [] to wrap the items inside the {article}{/article} tag, in which case change the syntax as appropriate. – Patrick Jackson Dec 2 '20 at 12:58
1

I fixed it with the following code:

if(!isset($this->item->jcfields)){

    $this->item->jcfields = FieldsHelper::getFields('com_content.article', $this->item, true);

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.