Reputation: 23
I created some advanced custom fields. One of them is a select
field, where you can choose between sale and charter.
I want to hide/show some of my advanced custom fields based on what is currently selected (sale or charter).
How can I do this?
Upvotes: 1
Views: 3185
Reputation: 904
The other answer covers the back end. For the front end template, something like this:
if (get_field('select_field_name') == 'sale'){
//show some stuff i.e. the_field('field_name');
}
elseif (get_field('select_field_name') == 'charter') {
//show other fields
}
else {
//maybe do something here
}
Upvotes: 0
Reputation: 26
As shown in image (Click link) there is an option in the ACF to show fields conditionally based on other fields value whether it is Checkbox or Select box.
Upvotes: 1