Home › Forums › Add-ons › Flexible Content Field › Flexible Content Layout Conditional › Reply To: Flexible Content Layout Conditional
When you use wp_register_script() set $in_footer to true.
Or alternately, just call wp_enqueue_script() with all of the arguments including $in_footer in your loop.
I’m using slick as well and in my template part for each layout I have something like this
wp_enqueue_script('slick', get_template_directory_uri().'/assets/vendor/slick/slick.min.js', array('jquery'), '1.8.1', true);
wp_enqueue_script('slick-init', get_template_directory_uri().'/js/slick-init.js', array('jquery', 'slick'), '1.0.0', true);
My slick init script actually is pretty complicated and I give each type of slider a different class and then initialize each class. This way I have just a single initialization script to load and it remains the same on all pages so that it can be cached by the browser and does not cause other caching issues.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.