Is it possible to create a dynamic field within an Advanced Custom Field?

1

I need to create a dynamic field by pulling information from the database that will be relating teachers and their characteristics and putting this field as Advanced Custom Fields] within a CPT UI named teachers.

The only thing I need to know is how to create this dynamic field.

It will probably be through a function within the functions.php that will relate this data and then turn on get_field within CPT articles.

    
asked by anonymous 27.08.2015 / 17:09

1 answer

2

It is possible, yes. You will need to include JavaScript / jQuery on this page and "listen" to changes in the dropdown. The changes will trigger Ajax calls and update the Meta Box of ACF dynamically.

It's not a little code or simple. ACF also has very specific nomenclatures for the boxes and fields you create in backend , and you'll need to inspect the DOM carefully to Correct IDs.

Here's a very close example of what you need: Display live preview of page on hover in WP admin using ACF relationship field .

Two other related:

PS: It's very important to create your own plugins to do this kind of thing, and not functions.php ; at the time you decide to change theme , you will be very grateful. Time to look for bugs too. See: Where do I put the snippets code I found here or somewhere else on the web?     

15.09.2015 / 04:46