Contact Form 7
Contact Form 7 Thank You Page
To redirect to a thank you page add this to the “Additional Settings” field: on_sent_ok: “location = ‘http://example.com/’;” This can be useful to track form submissions via Google Analytics and to invite the visitor to stay on the site
Read MoreTrack Contact Form 7 Submissions using Google Analytics
In additional settings field of Contact From 7 admin: on_sent_ok: “_gaq.push([‘_trackEvent’, ‘Contact Form’, ‘Submit’]);” Google Analytics will track it as an event with Contact Form as the Category, and Submit as the Action. In Google Analytics go to Content > Events > Overview
Read MoreContact Form 7 Stop Email Being Sent
To prevent the form sending its email use this in themes functions.php within a function: (might no longer work with WP3.5) // stop email being sent $wpcf7->skip_mail = 1; or put this in the additional settings field of the form demo_mode: on
Read MoreContact Form 7 Change Action URL
To send form output to a different file put this in themes functions.php. This code also limits this change to page 434 and adds the $wpcf7->skip_mail function to stop the form sending an email. //change action url of contact form add_filter(‘wpcf7_form_action_url’, ‘wpcf7_custom_form_action_url’); function wpcf7_custom_form_action_url($url) { global $post, $wpcf7; if ($post->ID === 434) { //its the…
Read MoreLoad Contact Form 7 JS Scripts Only When Needed
Contact Form 7 loads its scripts on all pages which uses memory and increases load time. Add this to functions.php to only load scripts when required: // only load js scripts for wpcf7 on contact and join pages // Add the Contact Form 7 scripts on selected pages add_action( ‘wp_print_scripts’, ‘my_deregister_javascript’, 100 ); function my_deregister_javascript()…
Read MoreContact Form 7 -Country Drop Down List
This short code gives a dropdown list of countries for Contact Form 7: [select country “—–” “Afghanistan” “Albania” “Algeria” “American Samoa” “Andorra” “Angola” “Anguilla” “Antigua and Barbuda” “Argentina” “Armenia” “Armenia” “Aruba” “Australia” “Austria” “Azerbaijan” “Azerbaijan” “Bahamas” “Bahrain” “Bangladesh” “Barbados” “Belarus” “Belgium” “Belize” “Benin” “Bermuda” “Bhutan” “Bolivia” “Bonaire” “Bosnia and Herzegovina” “Botswana” “Bouvet Island (Bouvetoya)” “Brazil”…
Read MoreContact Form 7 Field Shortcodes
Text Field: [text* business 64/100 id:business class:business watermark”business”] ‘text’ – field type ‘*’ – required ‘business’ – field name ’64/100′ – size/max characters ‘id’ – css id ‘class’ – css class ‘watermark’ – use default as watermark ‘ “business” ‘ – default Text Area: [text* business 100×5 id:business class:business watermark”business”] ‘100×5’ – columnsxrows. x5 =…
Read MoreHide Contactform 7 from editor role
In wp-config.php: /* limit access to contactform 7 */ define( ‘WPCF7_ADMIN_READ_CAPABILITY’, ‘manage_options’ ); define( ‘WPCF7_ADMIN_READ_WRITE_CAPABILITY’, ‘manage_options’ );
Read MoreDefault radio button in Contact Form 7
[radio volunteer default:2 “yes” “no”] Default is “no” selected
Read More