Contact form 7 shortcode appear outside form tag

It’s because your shortcode echoes the output than returning it — shortcodes should not echo the output, but return it — unless in certain cases like complex HTML markup in the output, where you need to use output buffering. So your code should look like: function cf7_shortcode() { return ‘<span>test shortcode</span>’; } add_shortcode( ‘cf7_shortcode’, ‘cf7_shortcode’ … Read more

Contact Form 7 pre email processing [closed]

Contact form 7 changed classes in 3.9 version. Now this is how it goes. add_action( ‘wpcf7_before_send_mail’, ‘process_form’ ); function process_form( $cf7 ) { $submission = WPCF7_Submission::get_instance(); if ( $submission ) { $posted_data = $submission->get_posted_data(); } if( $cf7->id() == 20 ) { $wpdb->insert(‘newsletter_signups’, array( ‘name’ => $posted_data[‘name’], ’email’ => $posted_data[’email’] ) ); } } Read more … Read more