-
-
Save BobaWebDev/b9a3fc2fc917e860574daadc63defe52 to your computer and use it in GitHub Desktop.
Simple Basic Contact Form Custom Fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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