Skip to content

Instantly share code, notes, and snippets.

@BobaWebDev
Last active October 1, 2018 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BobaWebDev/b9a3fc2fc917e860574daadc63defe52 to your computer and use it in GitHub Desktop.
Save BobaWebDev/b9a3fc2fc917e860574daadc63defe52 to your computer and use it in GitHub Desktop.
Simple Basic Contact Form Custom Fields
// add custom field values to the email
function myprefix_scf_custom_email_content( $content ) {
// get custom field values
$custom_field_value = scf_get_field_value( 'scf_custom_field_name' );
// the content added to the email
$content .= 'Custom Field Name: ' . $custom_field_value;
// pass it back to the plugin
return $content;
} add_filter( 'scf_custom_email_content', 'myprefix_scf_custom_email_content' );
// add custom fields to the form
function myprefix_scf_custom_fields( $custom_fields ) {
// custom fields ( HTML form fields )
$custom_fields .= '
<fieldset class="scf-name">
<label for="scf_custom_field_name">Custom Field Name</label>
<input name="scf_custom_field_name" id="scf_custom_field_name" type="text" />
</fieldset>';
// pass it back to the plugin
return $custom_fields;
} add_filter( 'scf_custom_fields', 'myprefix_scf_custom_fields' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment