# Filtering my sub navigation menu

**URL:** <https://forum.getkirby.com/t/filtering-my-sub-navigation-menu/28969>\
**Category:** Questions\
**Tags:** v3\
**Created:** [July 3, 2023, 10:29pm UTC](https://forum.getkirby.com/t/filtering-my-sub-navigation-menu/28969 "2023-07-03T22:29:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![learn79](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/learn79/32/13461_2.png) [@learn79](https://forum.getkirby.com/u/learn79)\
**Post date:** [July 3, 2023, 10:29pm UTC](https://forum.getkirby.com/t/filtering-my-sub-navigation-menu/28969/1 "2023-07-03T22:29:08Z")

</div>

Hi,

I watched this video [https://www.youtube.com/watch?v=bmz6NYUNWPk](https://www.youtube.com/watch?v=bmz6NYUNWPk)and I must say that it help me learn how to create the navigation menu. However, I would like to be able to filter the submenu to display certain items. This is the code:

```auto
<nav class="desktop-navigation">
      <ul>
        <li>
          <a href="#">Home</a>
          <ul class="dropdown">
            <?php foreach ($site->children() as $item): ?>
              <li><a href="<?= $item->url() ?>"><?= $item->title() ?></a></li>
            <?php endforeach ?>
          </ul>
        </li>
        <?php foreach ($site->children()->listed() as $item): ?>
          <li><a href="<?= $item->url() ?>"><?= $item->title() ?></a></li>
        <?php endforeach ?>
      </ul>
    </nav>
  </div>

```

The sub menu displays folders that exist inside the content folder such as kontakt, error, about, images, etc. which should not be showing in the sub menu. Grateful for your support.

---

<div class="post-metadata">

**Author:** ![learn79](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/learn79/32/13461_2.png) [@learn79](https://forum.getkirby.com/u/learn79)\
**Post date:** [July 4, 2023, 10:48am UTC](https://forum.getkirby.com/t/filtering-my-sub-navigation-menu/28969/2 "2023-07-04T10:48:15Z")

</div>

I’ve put put it like this in attempt to isolate the about folder:

```auto
<ul class="dropdown">
            <?php if ($item->id() != 'about'): ?>
    <li><a href="<?= $item->url() ?>"><?= $item->title() ?></a></li>
  <?php endif ?>

```

but the debugger gave the following error message: Undefined variable $item

---

<div class="post-metadata">

**Author:** ![learn79](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/learn79/32/13461_2.png) [@learn79](https://forum.getkirby.com/u/learn79)\
**Post date:** [July 4, 2023, 11:20am UTC](https://forum.getkirby.com/t/filtering-my-sub-navigation-menu/28969/3 "2023-07-04T11:20:50Z")

</div>

I was able to figure it out 🙂 and thought I would share this link in case someone stumbles across this topic [$pages-\>not() | Kirby CMS (getkirby.com)](https://getkirby.com/docs/reference/objects/cms/pages/not)
