<p>yes you can!</p>

<p>You may search for a slug <code>craft.entries.slug('slug-of-first-parent')</code>, select the first result <code>.one()</code>, and then the children by <code>.getChildren()</code>. Now you can proceed as you already did and limit your result to only elements with a level greater than 1 <code>.level('&gt;1')</code> and list.</p>

<pre><code>{% set pages = craft.entries.slug('slug-of-first-parent').one().getChildren().level('&gt;1') %}
</code></pre>

<p>I am not sure whether this is the best and most effective solution, but it should definitely do the job.</p>

<p><strong>Tip:</strong> You can display information about an entry and the methods and variables available by dumping them either by using <code>var_dump($variable)</code> in php code or <code>{{ d($variable) }}</code> (by using <a href="https://github.com/studioespresso/craft3-dumper" rel="nofollow noreferrer">this</a> free plugin) in your twig template. This can help a lot when dealing with entries and finding children or parents.</p>

CC BY-SA 4.0
2018-12-18T01:17:19.940Z
2018-12-18T01:22:50.960Z
2018-12-18T01:22:50.960Z
Luke
<p>I'm trying to display a list of child structure links, but only from a specific parent. The template I'm working on isn't for the parent in question so I don't think I can use 'entry.'</p>

<p>My structure is set up like this</p>

<ul>
<li><strong>Parent 1</strong> </li>
<li>--Child One</li>
<li>--Child Two</li>
<li>--Child Three</li>
<li><strong>Parent 2</strong></li>
<li>--Child One</li>
<li>--Child Two</li>
</ul>

<p>I only want to display the children of Parent 1. What I have so far is</p>

<pre><code>&lt;ul id="sub-menu"&gt;
{% set pages = craft.entries.section('visit').level('&gt;1') %}
{% nav entry in pages %}
&lt;li&gt;&lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;
    {% ifchildren %}
        &lt;ul&gt;
           {% children %}
        &lt;/ul&gt;
     {% endifchildren %}
&lt;/li&gt;
{% endnav %}
&lt;/ul&gt;
</code></pre>

<p>Using this outputs all of the second level children instead of just the children from Parent 1. Is there any way to specify that the only children I want to display must come from Parent 1? Can I specify a slug somehow?</p>

<p>Any help much appreciated</p>

<craft3><structure><navigation><children><parents>
How can I display second level children only from a specific parent structure item?
# How can I display second level children only from a specific parent structure item?

(Asked by: username_0 on 2018-12-17)

I'm trying to display a list of child structure links, but only from a specific parent. The template I'm working on isn't for the parent in question so I don't think I can use 'entry.'
My structure is set up like this

Parent 1 
--Child One
--Child Two
--Child Three
Parent 2
--Child One
--Child Two

I only want to display the children of Parent 1. What I have so far is

{% set pages = craft.entries.section('visit').level('>1') %}
{% nav entry in pages %}
{{ entry.title }}
    {% ifchildren %}
        
           {% children %}
        
     {% endifchildren %}

{% endnav %}


Using this outputs all of the second level children instead of just the children from Parent 1. Is there any way to specify that the only children I want to display must come from Parent 1? Can I specify a slug somehow?
Any help much appreciated

**Tags:** craft3, structure, navigation, children, parents


---

## 1 answers

### Answer by username_1 on 2018-12-18. Score: 4 | Accepted answer

yes you can!
You may search for a slug craft.entries.slug('slug-of-first-parent'), select the first result .one(), and then the children by .getChildren(). Now you can proceed as you already did and limit your result to only elements with a level greater than 1 .level('>1') and list.
{% set pages = craft.entries.slug('slug-of-first-parent').one().getChildren().level('>1') %}

I am not sure whether this is the best and most effective solution, but it should definitely do the job.
Tip: You can display information about an entry and the methods and variables available by dumping them either by using var_dump($variable) in php code or {{ d($variable) }} (by using this free plugin) in your twig template. This can help a lot when dealing with entries and finding children or parents.


---

