Contact Form 7
Add CSS Class to fields (4 posts)

  1. meg@info
    Posted 2 years ago #


    Is there a filters for adding more css class to fileds, ? im working with twitter bootstrap and i need to add css class to inputs, textarea and submit buttons .

    Thanks for answers,


  2. Takayuki Miyoshi
    Plugin Author

    Posted 2 years ago #

    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.

  3. meg@info
    Posted 2 years ago #

    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.


  4. chrillep
    Posted 2 years ago #

    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">.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Contact Form 7
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic