Added ACF into contact forms of known IDs. This is from the functions.php of CEO Media Group / Business Focus Magazine.
soak_variant()
figures out the site used and that is used to set which field group gets added in
// Content form field groups
if( function_exists('acf_add_local_field_group') ):
if (soak_variant() === 'cmg') :
acf_add_local_field_group(array(
'key' => 'group_1',
'title' => 'Contact Form - CMG',
'fields' => array (
array (
'key' => 'field_1',
'label' => 'Name',
"name" => "form_name_cmg",
"type" => "text",
"instructions" => "",
"required" => 1,
),
array (
'key' => 'field_2',
"label" => "Email",
"name" => "form_email_cmg",
"type" => "email",
"instructions" => "",
"required" => 1,
),
array (
'key' => 'field_3',
"label" => "Type of enquiry",
"name" => "form_enquiry_type_cmg",
"type" => "select",
"instructions" => "",
"required" => 1,
"choices" => array (
"Recruitment" => "Recruitment",
"Advertising" => "Advertising",
"Publication information" => "Publication information",
"Contract Publishing" => "Contract Publishing",
"Reception" => "Reception",
"Other" => "Other"
),
"default_value" => [],
"allow_null" => 0,
"multiple" => 0,
"ui" => 0,
"return_format" => "value",
"ajax" => 0,
"placeholder" => "",
),
array (
'key' => 'field_4',
"label" => "Message",
"name" => "form_message_cmg",
"type" => "textarea",
"instructions" => "",
"required" => 0,
"conditional_logic" => 0,
"hide_admin" => 1,
"default_value" => "",
"placeholder" => "",
"maxlength" => "",
"rows" => 16,
"new_lines" => "br"
),
array (
'key' => 'field_5',
"label" => "Privacy Agreement",
"name" => "form_privacy_agreement_cmg",
"type" => "true_false",
"instructions" => "",
"required" => 1,
"conditional_logic" => 0,
"wrapper" => array (
"width" => "",
"class" => "",
"id" => ""
),
"hide_admin" => 1,
"message" => "I agree to the <a href=\"" . get_home_url() . "/privacy-policy\">privacy statement</a>.",
"default_value" => 0,
"ui" => 0,
"ui_on_text" => "",
"ui_off_text" => ""
),
),
'location' => array (
array (
array (
'param' => 'af_form',
'operator' => '==',
'value' => 'form_5d5a9ff428b0f',
),
),
),
));
else :
acf_add_local_field_group(array(
'key' => 'group_2',
'title' => 'Contact Form - BFM',
'fields' => array (
array (
'key' => 'field_a',
'label' => 'Name',
"name" => "form_name_bfm",
"type" => "text",
"instructions" => "",
"required" => 1,
),
array (
'key' => 'field_b',
"label" => "Email",
"name" => "form_email_bfm",
"type" => "email",
"instructions" => "",
"required" => 1,
),
array (
'key' => 'field_c',
"label" => "Type of enquiry",
"name" => "form_enquiry_type_bfm",
"type" => "select",
"instructions" => "",
"required" => 1,
"choices" => array (
"Recruitment" => "Recruitment",
"Advertising" => "Advertising",
"Publication information" => "Publication information",
"Contract Publishing" => "Contract Publishing",
"Reception" => "Reception",
"Other" => "Other"
),
"default_value" => [],
"allow_null" => 0,
"multiple" => 0,
"ui" => 0,
"return_format" => "value",
"ajax" => 0,
"placeholder" => "",
),
array (
'key' => 'field_d',
"label" => "Message",
"name" => "form_message_bfm",
"type" => "textarea",
"instructions" => "",
"required" => 0,
"conditional_logic" => 0,
"hide_admin" => 1,
"default_value" => "",
"placeholder" => "",
"maxlength" => "",
"rows" => 16,
"new_lines" => "br"
),
array (
'key' => 'field_e',
"label" => "Privacy Agreement",
"name" => "form_privacy_agreement_bfm",
"type" => "true_false",
"instructions" => "",
"required" => 1,
"conditional_logic" => 0,
"wrapper" => array (
"width" => "",
"class" => "",
"id" => ""
),
"hide_admin" => 1,
"message" => "I agree to the <a href=\"" . get_site_url() . "/privacy-policy\">privacy statement</a>.",
"default_value" => 0,
"ui" => 0,
"ui_on_text" => "",
"ui_off_text" => ""
),
),
'location' => array (
array (
array (
'param' => 'af_form',
'operator' => '==',
'value' => 'form_5d8220cba83ad',
),
),
),
));
endif;
endif;