Hello!
Thanks for the feedback! Please be advised, this forum is a support platform for the ACF Extended plugin. The tutorial provided on the website let you customize the native ACF Form feature and your question is about general ACF development.
I just tested the code, and it is working correctly:
add_filter('acf/validate_form', 'acf_form_bootstrap_styles');
function acf_form_bootstrap_styles($args){
// Before ACF Form
if(!$args['html_before_fields'])
$args['html_before_fields'] = '<div class="row">'; // May be .form-row
// After ACF Form
if(!$args['html_after_fields'])
$args['html_after_fields'] = '</div>';
// Success Message
if($args['html_updated_message'] == '<div id="message" class="updated"><p>%s</p></div>')
$args['html_updated_message'] = '<div id="message" class="updated alert alert-success">%s</div>';
// Submit button
if($args['html_submit_button'] == '<input type="submit" class="acf-button button button-primary button-large" value="%s" />')
$args['html_submit_button'] = '<input type="submit" class="acf-button button button-primary button-large btn btn-primary" value="%s" />';
return $args;
}
ACF Form implementation:
acf_form(array(
'field_groups' => array('group_5f18a7cf4116d')
));
Please make sure that you didn’t set any parameters in the acf_form()
function for the html_before_fields
& html_after_fields
keys. As you can see, the acf/validate_form
hook will override it, but check if those keys have been set beforehand, using if(!$args['html_before_fields'])
.
This ACF Form implementation won’t work, if you define those keys:
acf_form(array(
'field_groups' => array('group_5f18a7cf4116d'),
'html_before_fields' => '',
'html_after_fields' => '',
));
Please make sure your configuration is correct.
Hope it helps.
Regards.