# How can I use isChildOf?

**URL:** <https://forum.getkirby.com/t/how-can-i-use-ischildof/4500>\
**Category:** Questions\
**Tags:** v2\
**Created:** [June 23, 2016, 3:45pm UTC](https://forum.getkirby.com/t/how-can-i-use-ischildof/4500 "2016-06-23T15:45:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![judbd](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/judbd/32/1303_2.png) [@judbd](https://forum.getkirby.com/u/judbd)\
**Post date:** [June 23, 2016, 3:45pm UTC](https://forum.getkirby.com/t/how-can-i-use-ischildof/4500/1 "2016-06-23T15:45:48Z")

</div>

is `<?php if($page->isChildOf('fiches')): ?>` is the correct syntax ? ([like in the example](https://getkirby.com/docs/cheatsheet/page/is-child-of))

I have and error message when I use it 🙂

> Catchable fatal error: Argument 1 passed to PageAbstract::isChildOf() must be an instance of Page, string given, called in templates/single-post.php on line 36 and defined in /kirby/core/page.php on line 887

I use this function on other websites without problem, Did I miss something ? (Sure it’s stupid but I can’t find what)

Thank you

---

<div class="post-metadata">

**Author:** ![judbd](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/judbd/32/1303_2.png) [@judbd](https://forum.getkirby.com/u/judbd)\
**Post date:** [June 23, 2016, 3:50pm UTC](https://forum.getkirby.com/t/how-can-i-use-ischildof/4500/2 "2016-06-23T15:50:18Z")

</div>

Ok, I think I found the problem, I have to do this:

`<?php if($page->isChildOf(page('fiches'))): ?>`

and it’s working. The example is not really clear as you can believe that the URI string is sufficient, like others kirby functions.

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [June 23, 2016, 4:03pm UTC](https://forum.getkirby.com/t/how-can-i-use-ischildof/4500/3 "2016-06-23T16:03:12Z")

</div>

Thanks for pointing this out. This is most likely a bug in Kirby (as that was supposed to work in older Kirby versions). And if it’s not, it is a bug in the docs.

I have added an [issue on GitHub](https://github.com/getkirby/kirby/issues/467).

---

<div class="post-metadata">

**Author:** ![judbd](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/judbd/32/1303_2.png) [@judbd](https://forum.getkirby.com/u/judbd)\
**Post date:** [June 23, 2016, 7:36pm UTC](https://forum.getkirby.com/t/how-can-i-use-ischildof/4500/4 "2016-06-23T19:36:59Z")

</div>

ha ok, I was wondering because I was quite certain I used it with the string on my portfolio (kirby 2.2) I have to watch it when I update!

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [July 12, 2016, 3:09pm UTC](https://forum.getkirby.com/t/how-can-i-use-ischildof/4500/5 "2016-07-12T15:09:09Z")

</div>

The syntax from the docs will work in Kirby 2.3.1.

---

<div class="post-metadata">

**Author:** ![judbd](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/judbd/32/1303_2.png) [@judbd](https://forum.getkirby.com/u/judbd)\
**Post date:** [July 29, 2016, 7:42pm UTC](https://forum.getkirby.com/t/how-can-i-use-ischildof/4500/6 "2016-07-29T19:42:52Z")

</div>

good, thank you very much !

---

<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, 4:57pm UTC](https://forum.getkirby.com/t/how-can-i-use-ischildof/4500/7 "2025-02-06T16:57:25Z")

</div>


