🎉 Launch Party!

discount for all licences until Aug 31.

Buy now →

Conditional logic

Show or hide fields based on certain rules to streamline the interface. Available with Modern Fields Pro.

Conditional logic is a container that lets you apply rules based on the value of fields in order to hide part of it, streamlining the user interface.

Conditional logique is only available in the pro versions of Modern Fields.

Configuration

First, go to Modern Fields > Fields groups and add the conditonal logic block. It’s a container where you can fit multiple fields inside.

You can define one or more combined rules to control the display of the container.

The rules only apply for the fields outside the container. You can set rules based on boolean, numeric and text values.

The conditional container and its rules

Usage

In the post displaying your field group, the conditional container will be hidden until the conditions are met.

If several rules are active, they must all be valid for the fields to appear.

When the rules are valid, the other fields appears

Get values from a conditional container

The conditional container has no impact on retrieving values on the front-end.

You can still use the usual the_field() and get_field() functions.

PHP

Repeater field

Options pages