Articles Anywhere

Check empty custom fields in an article custom fields list

4 months 4 days ago #89671

Octav A's Avatar Octav A

Hello,
In order to check and display only fields with values i use syntax like bellow. Please advise if is correct or maybe there is something shorter and more compact. Thanks

{article}
<ul>
{if custom1}
<li>Custom1:</span> [custom1]</li>
{else}{/if}
{if custom2}
<li>{Custom2}:</span> [custom2]</li>
{else}{/if}
...
...
...
</ul>
{/article}

4 months 3 days ago #89672

Andrea Malalana's Avatar Andrea Malalana Moderator

You don't need the empty {else} in there. Feel free to remove them.

4 months 3 days ago #89675

Octav A's Avatar Octav A

Thanks!