Add extra class in contact form 7 form tag

Hello friends, welcome to my another blog post how to add an extra class in contact form 7 form tag. Many people use contact form 7 plugin for the contact form or another purpose. Contact form 7 gives you extra power to add the class, id into your input fields(like input, text area, submit button etc). But if want to add your custom class into contact form 7 form tag then what to do?. Today I will give you the solution to add extra class in contact form 7 from tag.

Contact form 7 give us wpcf7_form_class_attr filter. Using this filter we can add extra class in form tag.



add_filter( 'wpcf7_form_class_attr', 'my_custom_form_class_attr' );

function my_custom_form_class_attr( $class ) {
	$class .= ' abhijit pal';
	return $class;
}

Add this code to your theme’s functions.php. After adding this class my form tag change. Now my form tag is

<form name="" action="/contact-me/#wpcf7-f494-p10-o1" method="post" class="wpcf7-form abhijit pal" novalidate="novalidate">

Now you know how to add an extra class in contact form 7 form tag. If you face any issue please comment below.

Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •