Home › Forums › General Issues › Load JS script after ACF › Reply To: Load JS script after ACF
Thank you Speakincode, that was a very good answer. I will try to answer better to clear things up a bit. I am trying to get ACF data using JS to post to the DOM (do I need PHP?).
This seems to work much better now, but I still don’t get the right things from ACF, I am trying this:
var acfVersion = acf.get('acf_version');
alert(acfVersion);
Maby it´s wrong.. I get ‘null’.
And this is the functions.php code:
add_action('acf/init', 'my_acf_admin_footer');
function my_acf_admin_footer() {
wp_register_script( 'custom-acf-js', get_template_directory_uri() . '/library/scripts/script-js.js', ['acf-input'], '1.0.0', true);
wp_enqueue_script('custom-acf-js');
}
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.