# Filter by toggle? - Kirby 3

**URL:** <https://forum.getkirby.com/t/filter-by-toggle-kirby-3/14732>\
**Category:** Questions\
**Tags:** v3\
**Created:** [June 26, 2019, 8:04pm UTC](https://forum.getkirby.com/t/filter-by-toggle-kirby-3/14732 "2019-06-26T20:04:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stef](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/stef/32/5109_2.png) [@stef](https://forum.getkirby.com/u/stef)\
**Post date:** [June 26, 2019, 8:04pm UTC](https://forum.getkirby.com/t/filter-by-toggle-kirby-3/14732/1 "2019-06-26T20:04:15Z")

</div>

Is there an example of how to filter by a toggle input?

my blueprint is like this:  
toggle:  
label: Toggle  
width: 1/3  
type: toggle  
text: Include in overview?

the posts should be filtered

```
<section class="masonry">
  <?php foreach ($pages->template('post') as $item) : ?>
    <figure class="masonry-item">
      <a href="<?= $item->url() ?>">
        <?= $item->images()->sortBy('sort', 'asc')->first()->resize(400) ?>
      </a>
    </figure>
  <?php endforeach ?>
</section>

```

---

<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:** [June 26, 2019, 8:08pm UTC](https://forum.getkirby.com/t/filter-by-toggle-kirby-3/14732/2 "2019-06-26T20:08:20Z")

</div>

> [@stef](#):
>
> \<?php foreach ($pages-\>template('post') as $item) : ?\>

This should work:

```auto
<?php foreach ($pages->template('post')->filterBy('toggle', true) as $item) : ?>

```

A toggle field’s content will either be `true` or `false`.

---

<div class="post-metadata">

**Author:** ![stef](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/stef/32/5109_2.png) [@stef](https://forum.getkirby.com/u/stef)\
**Post date:** [June 26, 2019, 8:10pm UTC](https://forum.getkirby.com/t/filter-by-toggle-kirby-3/14732/3 "2019-06-26T20:10:42Z")

</div>

that worked perfectly, thanks! seems quite obvious now
