Support » Plugin: Contact Form 7 » Add CSS Class to fields

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Takayuki Miyoshi


    No, there are no filter for class. Instead, you can probably utilize wpcf7_form_tag filter you can find in the includes/shortcodes.php file for such purposes.



    Thanks for purposes,

    by dumping the $tag array by this code :

    add_filter( 'wpcf7_form_tag', 'dump_wpcf7_form_tag_filter' );
    function dump_wpcf7_form_tag_filter( $tag ) {
      if ( ! is_array( $tag ) )
      return $tag;
      echo "<pre>";
       echo "</pre>";
      return $tag;

    ( PS: if you test the code, the result are double, it like do_shortcode_tag() is executed two time ?)

    I was made many tests, and i see that the css class for all components is returned by wpcf7_form_controls_class.

    i suggest adding a filter in wpcf7_form_controls_class function, this will make adding css class more easy.


    so if i was to add code to functions.php for bootstrap 3. How would i go about it?
    Ex. adding class “checkbox” to <input type="checkbox">.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add CSS Class to fields’ is closed to new replies.