Last active
October 18, 2024 14:28
-
-
Save spencermorin/6613780 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?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