<p>Found a solution, I needed: <code>{% if entry.hasDescendants() %}</code></p>

<pre><code>{% if entry.hasDescendants() %}

    &lt;div class="section bg-pattern"&gt;
        &lt;div class="inner"&gt;
            &lt;div class="col-24 gutter-bottom--half "&gt;
                &lt;h3&gt;Available {{ entry.title }}&lt;/h3&gt;

                {% for entry in craft.entries.section('yourAdventures').descendantOf( entry.id).find() %}

                    ...

                {% endfor %}
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;

{% endif %}
</code></pre>

CC BY-SA 3.0
2017-02-07T16:36:00.923Z
2017-02-08T00:42:50.180Z
2017-02-08T00:42:50.180Z
sarah3585
<p>If I figured out correctly what you want to do - this should do the trick:</p>

<pre><code>{% if entry.children | length  %}

    &lt;div class="section bg-pattern"&gt;
        &lt;div class="inner"&gt;
             &lt;div class="col-24 gutter-bottom--half"&gt;

                &lt;h3&gt;Available {{ entry.title }}&lt;/h3&gt;

                {% for child in entry.children %}
                    &lt;p&gt;{{ child.title }}&lt;/p&gt;
                {% endfor %}

            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;

{% endif %}
</code></pre>

<p><a href="https://craftcms.com/docs/templating/entrymodel#children" rel="noreferrer"><code>entry.children</code></a> is an alias for <a href="https://craftcms.com/docs/templating/entrymodel#getDescendants" rel="noreferrer"><code>entry.getDescendants(1)</code></a> which returns <a href="https://craftcms.com/docs/templating/elementcriteriamodel" rel="noreferrer"><code>ElementCriteriaModel</code></a></p>

<hr>

CC BY-SA 3.0
2017-02-06T11:37:30.220Z
Thanks for the reply. This is returning the child of the top level entry when in fact I need the second level down. I'll update my question with my entry structure as I see I've not been very clear.
sarah3585
CC BY-SA 3.0
2017-02-04T21:37:54.303Z
2017-02-04T21:37:54.303Z
Krzysztof Boduch
<p>I'm pulling in entries which are the descendant of the current entry id.</p>

<p>This is an example of my structure: Your Adventure > Honeymoon > A trip entry.</p>

<p>The below code is being used on the Honeymoon entry to list any trip entries that are children of the current page.</p>

<p>The below code is working fine apart from the if statement I'm wrapping it all in as I don't want any of the wrapping divs if there are no child pages within 'Honeymoon Trips'.</p>

<pre><code>{% if entry in craft.entries.section('yourAdventures').descendantOf(entry.id)  %}
&lt;!-- This is wrong --&gt;

&lt;div class="section bg-pattern"&gt;
    &lt;div class="inner"&gt;
         &lt;div class="col-24 gutter-bottom--half "&gt;
            &lt;h3&gt;Available {{ entry.title }}&lt;/h3&gt;
            {% for entry in craft.entries.section('yourAdventures').descendantOf( entry.id).find() %}

            ...

            {% endfor %}
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;

{% endif %}
</code></pre>

CC BY-SA 3.0
2017-02-04T20:40:58.293Z
Not sure I understand your question, but you probably just need to change your `{% if %}{% endif %}` to [`{% for %}{% endfor %}`](http://twig.sensiolabs.org/doc/2.x/tags/for.html)?
Mats Mikkel Rummelhoff
<entries><children>
Check if child entries exists
# Check if child entries exists

(Asked by: username_0 on 2017-02-04)

I'm pulling in entries which are the descendant of the current entry id.
This is an example of my structure: Your Adventure > Honeymoon > A trip entry.
The below code is being used on the Honeymoon entry to list any trip entries that are children of the current page.
The below code is working fine apart from the if statement I'm wrapping it all in as I don't want any of the wrapping divs if there are no child pages within 'Honeymoon Trips'.
{% if entry in craft.entries.section('yourAdventures').descendantOf(entry.id)  %}



    
         
            Available {{ entry.title }}
            {% for entry in craft.entries.section('yourAdventures').descendantOf( entry.id).find() %}

            ...

            {% endfor %}
        
    


{% endif %}

**Tags:** entries, children

> **Comments:**
> **username_1**: Not sure I understand your question, but you probably just need to change your `{% if %}{% endif %}` to [`{% for %}{% endfor %}`](http://twig.sensiolabs.org/doc/2.x/tags/for.html)?  

---

## 2 answers

### Answer by username_0 on 2017-02-07. Score: 1 | Accepted answer

Found a solution, I needed: {% if entry.hasDescendants() %}
{% if entry.hasDescendants() %}

    
        
            
                Available {{ entry.title }}

                {% for entry in craft.entries.section('yourAdventures').descendantOf( entry.id).find() %}

                    ...

                {% endfor %}
            
        
    

{% endif %}


---

### Answer by username_2 on 2017-02-04. Score: 6

If I figured out correctly what you want to do - this should do the trick:
{% if entry.children | length  %}

    
        
             

                Available {{ entry.title }}

                {% for child in entry.children %}
                    {{ child.title }}
                {% endfor %}

            
        
    

{% endif %}

entry.children is an alias for entry.getDescendants(1) which returns ElementCriteriaModel

> **Comments:**
> **username_0**: Thanks for the reply. This is returning the child of the top level entry when in fact I need the second level down. I'll update my question with my entry structure as I see I've not been very clear.  

---

