Search
Other Articles Anywhere questions
Forum

Custom fields using if statement not rendering/recognised

Steve's Avatar Steve
Joomla 4.3.4
AA v15.0.1PRO
CT v12.0.0PRO

I am using articles anywhere in conjunction with category templater to create an article template, this template loads into the article automatically based on category. It was working well until I went to use the if statement inside content templater. I must be doing something wrong.

I have a custom field "References" which is an editor custom field. Before trying the if statement the field was rendering in the article as expected. On some articles the content of the custom field is not required/entered so blank and I would not like a heading to appear associated with the custom field.

The syntax I use is (p tags as tinymc adds them):
<p>{if references}</p>
<h3>References</h3>
<p>{article}[references]{/article}</p>
<p>{/if}</p>

The front-end looks like image attached.


Your assistance would be appreciated.
Steve
Peter van Westen's Avatar Peter van Westen ADMIN
The {if} tag should be inside the {article} tag. Only {if}, {foreach} and data tags inside the {article} or {articles} tags are handled by Articles Anywhere.

So you probably want this:
<p>{article}{if references}</p>
<h3>References</h3>
<p>[references]</p>
<p>{/if}{/article}</p>
Please post a rating at the Joomla! Extensions Directory
Steve's Avatar Steve
Brilliant that was the answer, thank you Peter.

I knew I would be doing something wrong.
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription