# Conditional fields with conditions in OR - a workaround

**URL:** <https://forum.getkirby.com/t/conditional-fields-with-conditions-in-or-a-workaround/33220>\
**Category:** Questions\
**Tags:** v4\
**Created:** [December 28, 2024, 10:48am UTC](https://forum.getkirby.com/t/conditional-fields-with-conditions-in-or-a-workaround/33220 "2024-12-28T10:48:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hvsrmusic](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/hvsrmusic/32/2722_2.png) [@hvsrmusic](https://forum.getkirby.com/u/hvsrmusic)\
**Post date:** [December 28, 2024, 10:48am UTC](https://forum.getkirby.com/t/conditional-fields-with-conditions-in-or-a-workaround/33220/1 "2024-12-28T10:48:26Z")

</div>

Hi, I know that conditional fields with more than one condition works by design in “AND”. And I also know there’s a plugin to extend the behaviour.

But I wonder if it could be ok to duplicate the field to match the specific condition. My case is:

- I have 3 “post\_type”(s): “post”, “newmusic”, “news”

- “abstract” field should be visibile only it post\_type = “post” and post\_type = “newmusic”

- so I created a blueprint like this

…but it doesn’t work, as when the post type is “post” the fields remains hidden. Any other suggestion? Thanks.

---

<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:** [December 28, 2024, 12:12pm UTC](https://forum.getkirby.com/t/conditional-fields-with-conditions-in-or-a-workaround/33220/2 "2024-12-28T12:12:20Z")

</div>

Fields with the same name are not possible, why don’t you want to use the plugin?

---

<div class="post-metadata">

**Author:** ![hvsrmusic](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/hvsrmusic/32/2722_2.png) [@hvsrmusic](https://forum.getkirby.com/u/hvsrmusic)\
**Post date:** [December 28, 2024, 12:40pm UTC](https://forum.getkirby.com/t/conditional-fields-with-conditions-in-or-a-workaround/33220/3 "2024-12-28T12:40:15Z")

</div>

well… i’m trying to avoid using plugins as I’ve run into incompatibility issues in the past. Kirby goes forward… sometimes plugins won’t follow. Moreover I couldn’t find [GitHub - rasteiner/k3-whenquery: Conditionally show fields and sections. Better.](https://github.com/rasteiner/k3-whenquery) among the K4 plugins listen on the official site.

---

<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:** [December 28, 2024, 2:35pm UTC](https://forum.getkirby.com/t/conditional-fields-with-conditions-in-or-a-workaround/33220/4 "2024-12-28T14:35:54Z")

</div>

> [@hvsrmusic](#):
>
> sometimes plugins won’t follow

That can indeed happen.

If you absolutely don’t want to use the plugin, use two different field names, e.g. abstract\_post and abstract\_newmusic. Then you can call these fields conditionally in your template, depending on post type.

Example code:

```auto
<?php if (in_array($page->postType(), ['post', 'newmusic']) && $page->{'abstract_' . $page->postType()}()->isNotEmpty()): ?>
<div><?= $page->{'abstract_' . $page->postType()}() ?></div>
<?php endif ?>

```
