Skip to content

Instantly share code, notes, and snippets.

@spencermorin
Last active December 23, 2015 09:19
Show Gist options
  • Save spencermorin/6613780 to your computer and use it in GitHub Desktop.
Save spencermorin/6613780 to your computer and use it in GitHub Desktop.
<?php
function modify_contact_form_field_html( $field_html, $field_label, $post_id ) {
// Add HTML before the field.
$field_html = '<span>Before the field.</span>' . $field_html;
// Add HTML after the field.
$field_html .= '<span>After the field.</span>';
// Conditionally add based on field label and post id
if( 123 == $post_id && 'First Name' == $field_label )
$field_html .= '<span class="conditionally-added"></span>';
return $field_html;
}
add_filter( 'grunion_contact_form_field_html', 'modify_contact_form_field_html', 10, 3 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment