I am new to Craft CMS and although it is quite simple to use I am stuck on this one. I have 3 sections ('books', 'games', 'movies') and want to do the following:

{% for sub_entry in craft.entries('{{ entry.sectionName }}').find() %}

The problem is that it gives me all sub_entries not just the ones within a specific section i.e. entry.sectionName? If I print out {{ entry.sectionName }} on my website it gives me the correct sectionNames but somehow I can not pass it on to the for loop?

How do I solve this? Kind regards, Pete


In Craft/Twig, you'll never need to nest {{ and {% tags inside of each other.


{% for sub_entry in craft.entries('{{ entry.sectionName }}').find() %}

Should be:

{% for sub_entry in craft.entries(entry.sectionName).find() %}

hmm, wat do you mean with sub_entries? As a general pointer I would do it like this:

{% set books = craft.entries.section('books') %} 

and then loop over the books.

To get back to your question, I would suggest moving all the different sections into 1 channel with multiple types in it. For example:

Channel: Media


  • Books
  • Games
  • Movies

Then you can query them like this:

{% set books = craft.entries.section('media').type(['books']) %}

{% for entry in books %}
{% endfor %}

More info on types here

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.