Skip to main content
Modernized the answer.
Source Link

If you need to get the level 2 children for a specific Structureparent entry, and you have that entry's EntryModelentry model instance (i.e. you have an entry variable which refers, referring to the Structureparent entry), you can just use the EntryModel'sthat entry model's children property (which returns a pre-baked entry query, appendingfetching that entry's child entries only). Add the levellevel parameter to only pullfetch children fromat the desired level:

{% set children = entry.children().level(2).all() %}

There'sFor "standalone" entry queries, there's also athe descendantOf parameter which can be used in a craft.entries query – obviously, this. This should be set to the Structureparent entry's ID (or the complete EntryModelyou can also pass an entry model, ie.eg. entry):

{% set entries = craft.entries({
    'section' : 'yourSectionHandle',
    'level' : 2,
    'descendantOf' : entry.id
}) %}
{% set entries = craft.entries
    .section('yourSectionHandle')
    .descendantOf(entry.id)
    .level(2)
    .all()
%}

Also, ifIf you want to pullfetch entries from a structure section at a certain level in a Structure section, but not limit itlimited to children of a certainany particular parent entry, you can append the level parameter to your basic craft.entries queryentry query:

{% set entries = craft.entries.section('yourSectionHandle').level(2) %}

{% for entry in entries %}
    ...
{% endfor %}
{% set entries = craft.entries.section('yourSectionHandle').level(2).all() %}

Note that craft.entrieslevel queries can alsoparameter doesn't necessarily have to be typed out using object notation,an integer; if you prefer (I find the object notation more readablewant to fetch entries at any level at or above 2, especially if you havecan pass a lot of parameters)string prefixed with the >= operator:

{% set entries = craft.entries({
    'section' : 'yourSectionHandle',
    'level' : 2
}) %}
{% set entries = craft.entries.section('yourSectionHandle').level('>= 2').all() %}

Check out the official docs for the entry query level parameter for more examples.

If you need to get the level 2 children for a specific Structure entry, and you have that entry's EntryModel (i.e. you have an entry variable which refers to the Structure entry), you can just use the EntryModel's children property, appending level to only pull children from the desired level:

{% set children = entry.children().level(2) %}

There's also a descendantOf parameter which can be used in a craft.entries query – obviously, this should be the Structure entry's ID (or the complete EntryModel, i.e. entry):

{% set entries = craft.entries({
    'section' : 'yourSectionHandle',
    'level' : 2,
    'descendantOf' : entry.id
}) %}

Also, if you want to pull entries at a certain level in a Structure section but not limit it to children of a certain entry, you can append the level parameter to your basic craft.entries query:

{% set entries = craft.entries.section('yourSectionHandle').level(2) %}

{% for entry in entries %}
    ...
{% endfor %}

Note that craft.entries queries can also be typed out using object notation, if you prefer (I find the object notation more readable, especially if you have a lot of parameters):

{% set entries = craft.entries({
    'section' : 'yourSectionHandle',
    'level' : 2
}) %}

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.

added 777 characters in body
Source Link

YouIf you need to get the level 2 children for a specific Structure entry, and you have that entry's EntryModel (i.e. you have an entry variable which refers to the Structure entry), you can just use the EntryModel's children property, appending level to only pull entries belongingchildren from the desired level:

{% set children = entry.children().level(2) %}

There's also a descendantOf parameter which can be used in a craft.entries query – obviously, this should be the Structure entry's ID (or the complete EntryModel, i.e. entry):

{% set entries = craft.entries({
    'section' : 'yourSectionHandle',
    'level' : 2,
    'descendantOf' : entry.id
}) %}

Also, if you want to pull entries at a specificcertain level by appendingin a Structure section but not limit it to children of a certain entry, you can append the level parameter to your basic craft.entries query:

{% set entries = craft.entries.section('yourSectionHandle').level(2) %}

{% for entry in entries %}
    ...
{% endfor %}

The query itselfNote that craft.entries queries can also be typed out using object notation, if you prefer (I find the object notation more readable, especially if you have a lot of parameters):

{% set entries = craft.entries({
    'section' : 'yourSectionHandle',
    'level' : 2
}) %}

You can pull entries belonging to a specific level by appending the level parameter to your craft.entries query:

{% set entries = craft.entries.section('yourSectionHandle').level(2) %}

{% for entry in entries %}
    ...
{% endfor %}

The query itself can also be typed out using object notation, if you prefer (I find the object notation more readable, especially if you have a lot of parameters):

{% set entries = craft.entries({
    'section' : 'yourSectionHandle',
    'level' : 2
}) %}

If you need to get the level 2 children for a specific Structure entry, and you have that entry's EntryModel (i.e. you have an entry variable which refers to the Structure entry), you can just use the EntryModel's children property, appending level to only pull children from the desired level:

{% set children = entry.children().level(2) %}

There's also a descendantOf parameter which can be used in a craft.entries query – obviously, this should be the Structure entry's ID (or the complete EntryModel, i.e. entry):

{% set entries = craft.entries({
    'section' : 'yourSectionHandle',
    'level' : 2,
    'descendantOf' : entry.id
}) %}

Also, if you want to pull entries at a certain level in a Structure section but not limit it to children of a certain entry, you can append the level parameter to your basic craft.entries query:

{% set entries = craft.entries.section('yourSectionHandle').level(2) %}

{% for entry in entries %}
    ...
{% endfor %}

Note that craft.entries queries can also be typed out using object notation, if you prefer (I find the object notation more readable, especially if you have a lot of parameters):

{% set entries = craft.entries({
    'section' : 'yourSectionHandle',
    'level' : 2
}) %}
Source Link

You can pull entries belonging to a specific level by appending the level parameter to your craft.entries query:

{% set entries = craft.entries.section('yourSectionHandle').level(2) %}

{% for entry in entries %}
    ...
{% endfor %}

The query itself can also be typed out using object notation, if you prefer (I find the object notation more readable, especially if you have a lot of parameters):

{% set entries = craft.entries({
    'section' : 'yourSectionHandle',
    'level' : 2
}) %}