If you need to get the level 2 children for a specific parent entry, and you have that entry's entry model instance (i.e. you have an entry
variable, referring to the parent entry), you can use that entry model's children
property (which returns a pre-baked entry query, fetching that entry's child entries only). Add the level
parameter to only fetch children at the desired level:
{% set children = entry.children().level(2).all() %}
For "standalone" entry queries, there's also the descendantOf
parameter. This should be set to the parent entry's ID (you can also pass an entry model, e.g. entry
):
{% set entries = craft.entries
.section('yourSectionHandle')
.descendantOf(entry.id)
.level(2)
.all()
%}
If you want to fetch entries from a structure section at a certain level, but not limited to children of any particular parent entry, you can append the level
parameter to your basic entry query:
{% set entries = craft.entries.section('yourSectionHandle').level(2).all() %}
Note that level
parameter doesn't necessarily have to be an integer; if you want to fetch entries at any level at or above 2, you can pass a string prefixed with the >=
operator:
{% set entries = craft.entries.section('yourSectionHandle').level('>= 2').all() %}
Check out the official docs for the entry query level
parameter for more examples.