WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
Adding class to form (6 posts)

  1. lonchbox
    Member
    Posted 2 years ago #

    How can I add a class to my form. I´m using a framework that have some especial classes for forms but must to be with a class in form tag. It´s possible ?

    Thanx :)

    http://wordpress.org/extend/plugins/contact-form-7/

  2. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 2 years ago #

    wpcf7_form_class_attr filter is available. Add this code to your theme's functions.php.

    add_filter( 'wpcf7_form_class_attr', 'your_custom_form_class_attr' );
    
    function your_custom_form_class_attr( $class ) {
    	$class .= ' foo bar';
    	return $class;
    }
  3. lonchbox
    Member
    Posted 2 years ago #

    Takayuki Thanx, it works :)
    But what about if I need also to add a class to the button?

  4. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 2 years ago #

    For each field in a form, you can add 'class:' option in the tag.

    Example:
    [text* your-name 20/40 class:required "John Smith"]

    See docs.
    Text Fields

  5. beakyboy
    Member
    Posted 2 years ago #

    what code do I add to this to move the box to the right?

    `[select your-country class:class-name1 "Australia" "Brazil" "Canada" "Denmark" "Finland"]

    Thanks

  6. kremisoski
    Member
    Posted 2 years ago #

    .class-name1 {
    float:right;
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic