Here's my situation:
- Users submit company information using Gravity
- The company information is stored in a 'Company' custom post type with everything stored into custom fields or taxonomy options.
There's a about 15-20 dropdown or multiple-checkbox fields in the form - all of these need to store into the appropriate dropdown's in the custom post type custom fields.
My thinking is that it would be perfect to populate the dropdowns in the Gravity Form from the dropdown options specified in the custom fields - that way an admin can still go into the created post and modify the selections if need be. Is this possible? Would it save the selection in the Gravity entry and the custom post type custom field dropdown? Can somebody help me write this function? Keep in mind that it would need to be replicated about 15-20 times for this one form.
I'm using ACF for the custom fields and the newest Gravity Forms (with the Gravity Forms + Custom Post Types addition).
Examples to use:
The custom post type would be called 'Company'
The custom field be called: Number of Employees (number_of_employees)
Not sure this is necessary but the options would be:
Romel Apuya answers:
First Create a ACF custom field group and add a field with the same dropdown and use the same meta_key as your gravity form.
then use a function after submission to fetch the all matching keys as array and update the ACF field key (Show on screen -> ACF field value in ACF field group edit screen)
sample function below.
add_action("gform_after_submission_YOUR_FORM_ID", "gravity_post_submission", 10, 2);
function gravity_post_submission ($entry, $form)
$post_id = $entry["post_id"];
$values = get_post_custom_values("YOUR_CUSTOM_FIELD", $post_id);
update_field("ACF_FIELD_KEY", $values, $post_id);
if you can give me access to ur dev site.
I can help you create the looping function
This sounds great, would you be able to help with the looping function? Shall I message you directly?
Romel Apuya comments:
Romel Apuya comments:
Arnav Joy answers:
can you show me custom post type admin scree , how you are creating this dropdown value manually ?
Hi Arnav, here's a screen shot, the left screen is the creation of the options in ACF and the right screen is how they look in the custom post type admin screen.