-
Notifications
You must be signed in to change notification settings - Fork 0
Type – Condition
Henner R Setyono edited this page Mar 19, 2020
·
5 revisions
Wrap other options to only appear when the condition is fulfilled
custy_rand_id() => [
'condition' => [ 'sidebar_type' => 'type-2 | type-4' ],
'options' => [
'option1' => [ ... ],
'option2' => [ ... ],
],
],condition
- Accepts an array of option_id and it's expected value.
-
Value is NOT something
'condition' => [ 'button_style' => '!solid' ],
-
Condition for Checkboxes.
For example: we have checkboxes called
tease_elementsto select what to show in a Post Listing. The options aretitle,excerpt,featured_image,published_date, andauthor.Now we want an option to only appear if
authoris ticked. So we write it like this:'condition' => [ 'tease_elements/author' => true ]
-
Must fulfill MULTIPLE conditions
'condition' => [ 'tease_elements/title' => true, 'tease_elements/excerpt' => true ]
-
At least fulfill ONE condition
'condition' => [ 'any' => [ 'tease_elements/title' => true, 'tease_elements/excerpt' => true ] ]
-
Condition on Current Preview Size
'condition' => [ 'wp_customizer_current_view' => 'mobile' ]
Where to apply the code above?
- The option snippet is for New Section Filter
- The value format is for Default Value Filter
Learn more: