Skip to content

Instantly share code, notes, and snippets.

@ivo-ivanov
Last active November 1, 2019 11:08
Show Gist options
  • Save ivo-ivanov/6c7dcf391288b1949788d30a5dad5619 to your computer and use it in GitHub Desktop.
Save ivo-ivanov/6c7dcf391288b1949788d30a5dad5619 to your computer and use it in GitHub Desktop.
Add class to Contact Form 7 with filter. #wordpress #wpcf7
add_filter( 'wpcf7_form_class_attr', 'rl_wpcf7_form_class_attr' );
function rl_wpcf7_form_class_attr( $content ) {
$rl_formfind = '/wpcf7-form/';
$rl_formreplace = 'wpcf7-form customClass';
$content = preg_replace( $rl_formfind, $rl_formreplace, $content );
return $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment