# Display dynamically queried pages in the panel

**URL:** <https://forum.getkirby.com/t/display-dynamically-queried-pages-in-the-panel/33331>\
**Category:** Questions\
**Tags:** v4\
**Created:** [January 13, 2025, 3:12pm UTC](https://forum.getkirby.com/t/display-dynamically-queried-pages-in-the-panel/33331 "2025-01-13T15:12:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lkssmnt](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lkssmnt](https://forum.getkirby.com/u/lkssmnt)\
**Post date:** [January 13, 2025, 3:12pm UTC](https://forum.getkirby.com/t/display-dynamically-queried-pages-in-the-panel/33331/1 "2025-01-13T15:12:32Z")

</div>

Hi,

I have a website that has some projects. Each project page can have one or multiple authors which are also pages. These pages can be selected in the project panel page.

I would like to make the editors life a bit easier by then also displaying the related projects in the author page. These would have to be queried dynamically. In the frontend I fetch them like this but I don’t know how or if I can do this in the panel.

```auto
<?php $projects = $site->find("projects")->children()->filter(function ($child) use ($page) {
  return $child->author()->toPage()->is($page);
}) ?>

```

Thank you!

---

<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:** [January 13, 2025, 4:49pm UTC](https://forum.getkirby.com/t/display-dynamically-queried-pages-in-the-panel/33331/2 "2025-01-13T16:49:48Z")

</div>

You need a page method or page model method that you can then use within your pages section query.

---

<div class="post-metadata">

**Author:** ![lkssmnt](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lkssmnt](https://forum.getkirby.com/u/lkssmnt)\
**Post date:** [January 13, 2025, 7:16pm UTC](https://forum.getkirby.com/t/display-dynamically-queried-pages-in-the-panel/33331/3 "2025-01-13T19:16:56Z")

</div>

Could you please provide me with an example? I didn’t find any information how I could use a page method to query something in the blueprint. Thank you!!

---

<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:** [January 13, 2025, 7:36pm UTC](https://forum.getkirby.com/t/display-dynamically-queried-pages-in-the-panel/33331/4 "2025-01-13T19:36:37Z")

</div>

> **[Pages section](https://getkirby.com/docs/reference/panel/sections/pages#filtering-pages__query)**
>
> List and edit subpages

Since you cannot use that rather complex query, you need to move it to some method, ideally in a model for the author page.

Your section in the author.yml

```auto
  pages:
    type: pages
    query: page.getProjectsForAuthor()

```

The in a model for the author page (site/models/author.php, provided those author page use an author.yml blueprint:

```auto
class AuthorPage extends Page
{
    public function getProjectsForAuthor()
    {
        return page('projects')->children()->listed()->filter(fn($child) => $child->authors()->toPages()->has($this));
    }

  
}

```

---

<div class="post-metadata">

**Author:** ![lkssmnt](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lkssmnt](https://forum.getkirby.com/u/lkssmnt)\
**Post date:** [January 14, 2025, 8:04am UTC](https://forum.getkirby.com/t/display-dynamically-queried-pages-in-the-panel/33331/5 "2025-01-14T08:04:13Z")

</div>

Ahh, I didn’t know I could use methods or fields in a blueprint query like that. Thank you!!
