Home › Forums › Pre-purchase Questions › acf_form and AMP › Reply To: acf_form and AMP
This depends on how you implement it. The function acf_form_head()
call that is required needs to be before any html is output. Calling this function is what causes all of the JS to be loaded and what causes the form to be processed when submitted.
If you put this in your header.php file then it will be loaded site wide.
If this is put in the template file for the page just before get_header()
then it will be loaded on any page using that template.
You can have it loaded on just pages that have use acf_form()
by creating a page template that will only be used for these pages.
There are potentially other ways that this can be done as well but each gets a little more complicated.
For example, you could have an init action
add_action('init', 'some_function_name_here');
some_function_name_here() {
if (/*some condition*/) {
acf_form_head();
}
}
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.