Skip to main content
updated
Source Link

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  ?

Update:

{% set featuredEvents = craft.entries.section('events').featuredEntry(1).limit(10).orderBy('offerStartDate') %}

on the template

{% for featuredEvent in featuredEvents %}

When we limit to 10, why `{% for featuredEvent in featuredEvents %} line highlight for

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

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  ?

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?

Update:

{% set featuredEvents = craft.entries.section('events').featuredEntry(1).limit(10).orderBy('offerStartDate') %}

on the template

{% for featuredEvent in featuredEvents %}

When we limit to 10, why `{% for featuredEvent in featuredEvents %} line highlight for

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

on the template

_events.twig

**_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**

_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 ?

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 ?

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 ?

Source Link

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 ?