# Hasvisiblechildren... how to display the content of a subpage in a parent page

**URL:** <https://forum.getkirby.com/t/hasvisiblechildren-how-to-display-the-content-of-a-subpage-in-a-parent-page/8680>\
**Category:** Questions\
**Tags:** v2\
**Created:** [October 3, 2017, 3:11pm UTC](https://forum.getkirby.com/t/hasvisiblechildren-how-to-display-the-content-of-a-subpage-in-a-parent-page/8680 "2017-10-03T15:11:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kate](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/kate/32/5552_2.png) [@Kate](https://forum.getkirby.com/u/Kate)\
**Post date:** [October 3, 2017, 3:11pm UTC](https://forum.getkirby.com/t/hasvisiblechildren-how-to-display-the-content-of-a-subpage-in-a-parent-page/8680/1 "2017-10-03T15:11:24Z")

</div>

It’s a long time I have been here…

This seems to be very simple but I cannot get the thing to work:

I want to mix static and dynamic content on a page. It’s about actions and events. There are some general informations about events that I want to provide (like what kind of events and how to book them) and concrete events with all the **content** (images included), on top of the page:

I tried something like this:

```auto
    <?php if($page->hasVisibleChildren()) {
      $children = $p->children()->visible();
     ...
    }?>
    <?php endif ?>

```

Is there anybody who can give me a hint?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [October 3, 2017, 3:22pm UTC](https://forum.getkirby.com/t/hasvisiblechildren-how-to-display-the-content-of-a-subpage-in-a-parent-page/8680/2 "2017-10-03T15:22:15Z")

</div>

Two issues:

- you use curly braces but endif, remove endif or the curly braces
- `$p` is not defined, use `$page`

Turn on debugging to get error messages!

```auto
<?php if($page->hasVisibleChildren()):
$children = $page->children()->visible();
//…
?>
<?php endif ?>

```

---

<div class="post-metadata">

**Author:** ![jimbobrjames](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jimbobrjames/32/5802_2.png) [@jimbobrjames](https://forum.getkirby.com/u/jimbobrjames)\
**Post date:** [October 3, 2017, 3:23pm UTC](https://forum.getkirby.com/t/hasvisiblechildren-how-to-display-the-content-of-a-subpage-in-a-parent-page/8680/3 "2017-10-03T15:23:02Z")

</div>

```auto
<?php foreach($page->children()->visible() as $child): ?>
    <h2><?= $child->title()->html() ?></h2>
<?php endforeach ?>

```

---

<div class="post-metadata">

**Author:** ![Kate](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/kate/32/5552_2.png) [@Kate](https://forum.getkirby.com/u/Kate)\
**Post date:** [October 3, 2017, 4:23pm UTC](https://forum.getkirby.com/t/hasvisiblechildren-how-to-display-the-content-of-a-subpage-in-a-parent-page/8680/4 "2017-10-03T16:23:07Z")

</div>

Thanks to both of you. So simple…

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:32pm UTC](https://forum.getkirby.com/t/hasvisiblechildren-how-to-display-the-content-of-a-subpage-in-a-parent-page/8680/5 "2025-02-06T17:32:01Z")

</div>

Archived on February 6, 2025, 5:32pm UTC


