Answers.Body: <p>If you need to get the level 2 children for <em>a specific parent entry</em>, and you have that entry's <a href="https://craftcms.com/docs/4.x/entries.html" rel="nofollow noreferrer">entry model instance</a> (i.e. you have an <code>entry</code> variable, referring to the parent entry), you can use that entry model's <code>children</code> property (which returns a pre-baked <a href="https://craftcms.com/docs/4.x/entries.html#querying-entries" rel="nofollow noreferrer">entry query</a>, fetching that entry's child entries only). Add the <a href="https://craftcms.com/docs/4.x/entries.html#level" rel="nofollow noreferrer"><code>level</code> parameter</a> to only fetch children at the desired level:</p>
  <pre><code>{% set children = entry.children().level(2).all() %}
  </code></pre>
  <p>For &quot;standalone&quot; <a href="https://craftcms.com/docs/4.x/entries.html#querying-entries" rel="nofollow noreferrer">entry queries</a>, there's also the <code>descendantOf</code> parameter. This should be set to the parent entry's ID (you can also pass an entry model, e.g. <code>entry</code>):</p>
  <pre><code>{% set entries = craft.entries
      .section('yourSectionHandle')
      .descendantOf(entry.id)
      .level(2)
      .all()
  %}
  </code></pre>
  <p>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 <code>level</code> parameter to your basic <a href="https://craftcms.com/docs/4.x/entries.html#querying-entries" rel="nofollow noreferrer">entry query</a>:</p>
  <pre><code>{% set entries = craft.entries.section('yourSectionHandle').level(2).all() %}
  </code></pre>
  <p>Note that <code>level</code> 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 <code>&gt;=</code> operator:</p>
  <pre><code>{% set entries = craft.entries.section('yourSectionHandle').level('&gt;= 2').all() %}
  </code></pre>
  <p>Check out <a href="https://craftcms.com/docs/4.x/entries.html#level" rel="nofollow noreferrer">the official docs for the entry query <code>level</code> parameter</a> for more examples.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-16T21:25:32.740Z
Answers.Text: Thanks for this, I didn't know how to use descendantOf.
Answers.UserDisplayName: mateostabio
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2016-06-04T20:56:25.943Z
Answers.LastActivityDate: 2023-05-04T00:01:58.060Z
Answers.LastEditDate: 2023-05-04T00:01:58.060Z
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Body: <p>I'm new in the Craft CMS world. Today I start so build my first website with Craft.</p>
  
  <p>I have a Structure with 2 Levels. Now I want so get the children from level 2. The level 1 entries are overview-pages for the content in the level 2 pages. I've build 2 entry types. One for the content and one overview pages.</p>
  
  <p>Thx for your help :)
  Alexander</p>
  
Tags: <structure>
Title: Get children from a Structure entry
ThreadText: # Get children from a Structure entry
  
  (Asked by: username_0 on 2016-06-04)
  
  I'm new in the Craft CMS world. Today I start so build my first website with Craft.
  
  I have a Structure with 2 Levels. Now I want so get the children from level 2. The level 1 entries are overview-pages for the content in the level 2 pages. I've build 2 entry types. One for the content and one overview pages.
  
  Thx for your help :)
  Alexander
  
  **Tags:** structure
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-06-04. Score: 23 | Accepted answer
  
  If you need to get the level 2 children for *a specific parent entry*, and you have that entry's [entry model instance](https://craftcms.com/docs/4.x/entries.html) (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](https://craftcms.com/docs/4.x/entries.html#querying-entries), fetching that entry's child entries only). Add the [`level` parameter](https://craftcms.com/docs/4.x/entries.html#level) to only fetch children at the desired level:
  
  ```
  {% set children = entry.children().level(2).all() %}
  
  ```
  
  For "standalone" [entry queries](https://craftcms.com/docs/4.x/entries.html#querying-entries), 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](https://craftcms.com/docs/4.x/entries.html#querying-entries):
  
  ```
  {% 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](https://craftcms.com/docs/4.x/entries.html#level) for more examples.
  
  > **Comments:**
  > **username_2**: Thanks for this, I didn't know how to use descendantOf.  
  
  ---
  
  