I have created a summary template in the form of a slideshow to display featured news articles, to sort the featured articles from the non-featured ones I have added a custom field definition called 'Featured', it is a checkbox.
I am now trying to use this field to define which articles make it into the slideshow - ie: only the more impactful ones have the 'Featured' value of true. To do this I thought it would be a simple case of adding this inside the foreach loop:
Code: Select all
{if $entry->fields.Featured->value == 'true'} [display formatted article summary here] {/if}
I have checked that the custom field is 'public', and also tried to find the answer via other posts to the forum without success...
The {foreach} loop for the template was working fine without the {if} statement, and it currently looks like this:
Code: Select all
{foreach from=$items item=entry}
{if $entry->fields.Featured->value == 'true'}
<div style="background: url({$entry->file_location}/{$entry->fields.image_1->value}); background-size:100%; background-position:center;">
<div class="grid_5 offset_7">
<h3><a href="{$entry->moreurl}" title="{$entry->title}">{$entry->title}</a></h3>
<p>{$entry->fields.slide_text->value} <a href="{$entry->moreurl}">More >></a></p>
</div>
</div>
{/if}
{/foreach}
I am using v 2.1.5