3

I have five separate sections with x number of entries each. I would like to render all the entries from all the sections on a single entry template page. Is there a way to do this ? I know we can set entries like this {% set entries = craft.entries.section('sectionHandle').limit(10) %} , but I'm not sure how to get entries from all the sections.

Any help or suggestion is highly appreciated.

Thanks!

8

You can insert an array of different sections instead of a single one to pull entries from multiple sections

{% set entries = craft.entries.section(['sectionHandle', 'sectionHandleTwo']).limit(10) %}

You can also write that

{% set entries = craft.entries({
  section: ['sectionHandle', 'sectionHandleTwo'],
  limit: 10
}) %}

If you remove the .section() / section:..., entirely you'll fetch all entries from all sections. Here's a link to the docs

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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