I’ve just revisited this and thought I’d share in detail how I did it. It’s an application of John’s thinking.
My problem to begin with was I wanted to add a repeating field to the job submission form of WP Job Manager (specifically in Listify – should work across other themes)
Create your field group containing the repeating fields and grab the field group ID. You can find this in the URL of the edit field group page for your field group under Custom Fields.
In your theme or child theme, create a folder called job_manager, and copy in job-submit.php from plugins/wp-job-manager/templates. This will be used instead of the default job submission form.
Paste in the following code where you would like the repeating field to appear. I chose line 51 so it would appear after all other fields. I haven’t tested other locations but I guess it should work.
<?php acf_form(array(
'post_id' => $job_id,
'field_groups' => array(your field group ID num here),
'form' => false,
'return' => '' // do not redirect, let WP Job Manager take care of it
)); ?>
Without using a blank return you get issues with the page not redirecting to the proper URL and display submission success messages.
I had issues with acf_form_head() so am adding it in functions.php. You could always add a check to just add it if on a certain URL, using a template etc. Simply though:
add_action( 'init', 'acf_head_add' );
function acf_head_add(){
acf_form_head();
}
Hope that helps.
Did you ever find a working solution?
I want to add an ACF repeating field to the WP Job Manager form used in Listify. Anything you can share would help 😉
To update, I’m using child theme and am inserting the fields:
add_filter( 'submit_job_form_fields', 'frontend_add_custom_fields' );
function frontend_add_custom_fields( $custom_fields ) {
$custom_fields = acf_form(array(
'field_groups' => array(882),
'form' => false ));
return $custom_fields;
}
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.