WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
[resolved] Change Width of a form? (6 posts)

  1. kkniskern
    Member
    Posted 3 years ago #

    Please check the following page and let me know how I can change the width of the form to fit in the sidebar.

    http://stsok.com/testimonials/

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

  2. kkniskern
    Member
    Posted 3 years ago #

    nevermind... I found it.

  3. debfahey
    Member
    Posted 3 years ago #

    Can you please share with us what your solution was? THX

  4. optimisticfriend
    Member
    Posted 3 years ago #

    I'm not sure if this is the only way, but here is one way:
    Under the plugin directory:
    /plugins/contact-form-7/modules/
    Edit the following two files text.php and textarea.php

    Both have a "default size" that is set to:
    size="40" (columns)
    size="10" (rows)

    text.php (line 75 or so of the code)

    if ( $size_att )
    		$atts .= ' size="' . $size_att . '"';
    	else
    		$atts .= ' size="40"'; // default size

    Change "40" to something else (smaller width is size="30" columns). You'll see a similar line of code for rows.

    textarea.php (line 72 or so of the code)

    if ( $cols_att )
    		$atts .= ' cols="' . $cols_att . '"';
    	else
    		$atts .= ' cols="40"'; // default size
    
    	if ( $rows_att )
    		$atts .= ' rows="' . $rows_att . '"';
    	else
    		$atts .= ' rows="10"'; // default size

    NOTE: When you upgrade to the next version of the plugin, you'll need to do this again. Anyone know a better way to do this so you don't need to re-edit after each new version?

  5. optimisticfriend
    Member
    Posted 3 years ago #

    Anyone know how to change the column and row width using the "Additional Settings" feature in Contact Form 7?

  6. optimisticfriend
    Member
    Posted 3 years ago #

    Found a better way! When making your form, use this:
    [text* phone 30/50]
    This creates 30 columns (width) and 50 (maxlength)
    [textarea* your-message 20/3] = 20 cols / 3 rows
    See:
    http://blog.strategy11.com/contact-form-7-widget/comment-page-1/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic