1

I'm trying to loop through two separate channels, but combined together. And then just check which channel the entry belongs to in the loop to display it correctly. This is how I had it done in EE, but I can't seem to find a way with Craft.

{exp:channel:entries channel="press|in-the-press" orderby="date" dynamic="no" limit="10"}

1 Answer 1

3

According to the Craft docs, the section parameter takes a "section handle, an array of section handles, or a SectionModel object". So this should work:

{% set entries = craft.entries.section(['press', 'in-the-press']).limit(10) %}

{% for entry in entries %}
    {{ entry.title }}
{% endfor %}
1
  • got it, i was forgetting the brackets. thanks :)
    – Dave Joyce
    Oct 15, 2017 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.