AdvancedCustomFields / acf

Advanced Custom Fields
http://advancedcustomfields.com/
875 stars 182 forks source link

how to use multicheck in ACF #234

Open iranimij opened 5 years ago

iranimij commented 5 years ago

i use CMB2 in my theme and i want convert all field to ACF fields BUT i don't find a multicheck field like that in the ACF

i want to create multiple check box dynamically from my custom taxonomy ,

for ex : Screenshot_2019-10-14 API (idx) ‹ My Great Blog — WordPress

all these checkbox getting from my custom taxonomy in CMB2 with this code : $cmb->add_field(array( 'name' => __('Default Listing Filter Areas', 'realtybloc'), 'id' => 'featured_listing_default_areas', 'type' => 'multicheck_inline', 'options' => Helper::getAreasForFilterArray(), )); when any change occur in my custom taxonomy directly my checkboxes changed.

elliotcondon commented 5 years ago

Hi @iranimij

The CMB2 multicheck field looks similar to our Checkbox field(https://www.advancedcustomfields.com/resources/checkbox/).

You can dynamically add "choices" to a checkbox field using the "acf/load_field" filter.

Or, perhaps you would prefer to use a Taxonomy field instead (https://www.advancedcustomfields.com/resources/taxonomy/). The taxonomy field will auto populate all the choices for you so you don't have to write any custom code. You can also use a "dropdown" display mode to allow for AJAX searching!