ACF – Attach JS file depending on ACF field

When the user creates a “carousel” – layout from a flexible content field within ACF, I need to load all the related jquery js files into the page header.

As far as I understand WP tpl files are not preprocessed. Therefor there is no way to place some kind of markup into the tpl so that the header template will create the necessary script scr loads.

Do I have to put all the js globally into the head of the site or page. Regardless if the user really picked the bootstrap carousel for his/her page?

Read more here:: ACF – Attach JS file depending on ACF field

Leave a Reply

Your email address will not be published. Required fields are marked *