Conditions API
For a one-off PHP display rule, use the built-in Custom PHP condition. Use this API when an extension needs to add a reusable condition to the picker.
The Conditions API adds a condition to Breakdance's element display picker. Register its label, operands, optional values, and evaluation callback on breakdance_register_template_types_and_conditions:
add_action('breakdance_register_template_types_and_conditions', function () {
BreakdanceConditionsAPIregister([
'slug' => 'acme-post-format',
'label' => 'Acme Post Format',
'category' => 'Acme',
'supports' => ['element_display'],
'operands' => ['is', 'is not'],
'values' => function () {
return [['label' => 'Formats', 'items' => [
['text' => 'Standard', 'value' => 'standard'],
['text' => 'Video', 'value' => 'video']
]]];
},
'callback' => function ($operand, $value) {
$format = get_post_format() ?: 'standard';
if ($operand === 'is') return $format === $value;
if ($operand === 'is not') return $format !== $value;
return false;
}
]);
});
The example evaluates the current post format.

Contract
BreakdanceConditionsAPIregister($condition) returns nothing. Required keys: slug, label, category, supports, operands, callback.
Optional values returns groups (label, items) containing text/value records; omission allows open input. allowMultiselect supplies arrays. Callbacks may accept optional third argument $ruleDynamic for dynamic-value configuration.
Operands and Values
Operands are strings passed unchanged to your callback. Offer only the comparisons your callback implements, such as is and is not.
values is a callback returning groups. Each group has a label and items; each item has display text and a stored value. You can supply several groups. Omit values to offer a text input instead of a dropdown.
Allow Multiple Values
Set allowMultiselect to true to let users select several dropdown values. The callback then receives an array of strings, rather than one string:
'allowMultiselect' => true,
'callback' => function ($operand, $value) {
$format = get_post_format() ?: 'standard';
if ($operand === 'is') {
return in_array($format, $value, true);
}
if ($operand === 'is not') {
return !in_array($format, $value, true);
}
return false;
},
Use this fragment in place of the single-value callback in the registration example. Return true to show the element and false to hide it.
Supported Contexts
The public GitHub API documents supports => ['element_display']. It describes public APIs for query-builder and templating conditions as future work; do not assume that adding 'templating' supplies a separate supported template-registration API.
In the current shared implementation, supports selects the picker: element_display for element display and templating for template conditions. Include both to offer the condition in both places. The template picker applies this check in its client interface.
The wrapper fixes availableForType to ['ALL'], so a condition offered for templating is not restricted to a particular template type. There is no public wrapper option for narrowing that list. Use unique slugs: the first registered condition with a slug wins.