I'm trying to limit the amount of entries on my page.
Currently I want 1 news entry (based on if the checkbox is ticked, there could be 10 entries with the checkbox ticked but I only want to show 1 (the latest)) The issue is that the limit() twig function doesn't work with my elementCriteriaModel.
My code:
{# Checking if any news entries have the FeaturedEntry field completed #}
{% for entry in craft.entries.section('news').level(2) %}
{% if entry.featured.contains('isFeatured') %}
{% set news = craft.entries.section('news') %}
<div class="insight orange">
<a href="{{ entry.url }}">
<h4>News *Chosen*</h4>
<h3>{{ entry.title }}</h3>
<div class="details">
<span class="author">{{entry.author}}</span>
</div>
</a>
</div>
{% else %}
Do Something Else Here
If I attach the limit function to {% for entry in craft.entries.section('news').level(2).limit(1) %}, this only limits the amount of entries my selector can check for the featured field. If i put limit(1) it only checks the first news entry for the field.
I know i can use the slice function but I'm having some trouble inserting it into the right place.
Any help would be very appreciated.