Skip to main content
1 of 3

Looping through element queries directly has been deprecated

on the template

**_events.twig**
{% include "./components/_listing" with {
  entries: craft.entries.section('events').orderBy('eventStartDate ASC').limit(3),
  columns: 3,
  heading: 'On this month',
  art: 'art3',
  headings: true
} %}


**__listing.twig**
{% if pagination is defined and pagination == true %}
        {% paginate entries as pageInfo, pageEntries %}
    {% else %}
        {% set pageEntries = entries %}
    {% endif %}

    <div class="container">
        <div class="c-listing-items">
             {% for entry in pageEntries %}
    ~~~~

"Looping through element queries directly has been deprecated. Use the all() function to fetch the query results before looping over them."

The line number is {% for entry in pageEntries %}

I referred Explanation of Deprecation Warnings and Output deprecation error

But seems I'm away from those two answers.

Can someone suggest me to find a solution for this ?