WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
How can I add custom atts to contact form shortcode (1 post)

  1. d.clixer
    Member
    Posted 1 year ago #

    How can I add custom atts to contact form shortcode

    [contact-form-7 id="108" title="Contact form 1" bg_color="red"]
    
           // custom background
           add_filter( 'wpcf7_form_elements','mycustom_wpcf7_form_elements');
    
           function mycustom_wpcf7_form_elements( $form ) {
              extract(shortcode_atts(array(
                    'id' => '',
                    'title' => '',
    		'bg_color' => ''
       	  ), $atts));
              echo "<style> #{$id} { background : $bg_color } </style>";
    
    	  $form = do_shortcode( $form );
    	  return $form;
           }

    how should I do
    if there is more than one form in one page

    thanks before..

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic