Wrapper help

Hi.

I just want to know what you think i should do in the following situation:
on my last website build: price4me.co.uk I used the sage theme but i had problems getting the wrapper to play nicely with front end ACF forms.

Basically when you code a ACF_form it needs to be setup with acf_form_head(); before any html is put out. also when you use acf/save_post to do something with the filled form data this needs to be above acf_form_head();

I found myself having to pass data (that i would normally set up in my template) over to the acf form, but because the base had already sent html output, the form would break because you have to set up the acf/save_post functions and acf_form_head() before any html output.

so what i had to do was remove the wrapper and not use the base.php so that i could setup the acf/save_post functions and acf_form_head(); before any html was output.

Is there a way of getting around this problem?

See here: ACF Pro Frontend Form Errors with Sage

You could probably hook into the the template_include action too.

thanks. I will try that in my next project.

For the template_include hook would that just be to detect what page is loading so that i don’t have the acf code running on all page loads? or something more that this?

e.g:
add_filter( ‘template_include’, ‘is_portfolio_page’, 99 );

function is_portfolio_page( $template ) {
if ( is_page( ‘portfolio’ ) ) {

}	

}

Yes. Hooking in just allows you to be selective over when to load the ACF logic and keeps your logic outside of the templates. You could probably use something earlier in the load than template_include.