How to limit the amount of entries that is output when limit doesn't work 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') %}

            &lt;div class="insight orange"&gt;
                &lt;a href="{{ entry.url }}"&gt;
                    &lt;h4&gt;News *Chosen*&lt;/h4&gt;
                    &lt;h3&gt;{{ entry.title }}&lt;/h3&gt;
                    &lt;div class="details"&gt;
                        &lt;span class="author"&gt;{{entry.author}}&lt;/span&gt;
                    &lt;/div&gt;
                &lt;/a&gt;
            &lt;/div&gt;

    {% 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.
What you probably want is to order them by date and than select the first.

{% set news = craft.entries.section('news').order('postDate desc').first() %}


And if you want to use limit somewhere (but I don't think this is what you are trying to get here) you should add limit(1) to this {% set news = craft.entries.section('news').limit(1) %}