Custom contact form 7 select with custom values [closed]

You can set the values with the filter wpcf7_form_tag and add the shortcode attributes with the filter shortcode_atts_wpcf7 add_filter(“wpcf7_form_tag”, function($scanned_tag, $replace){ if (“press_post” === $scanned_tag[“name”]) { $contact_form = WPCF7_ContactForm::get_current(); $number_of_posts = $contact_form->shortcode_attr(“number_of_posts”); $post_type = $contact_form->shortcode_attr(“post_type”); // using $number_of_posts and $post_type here $scanned_tag[‘raw_values’] = [ “number_of_posts \”$number_of_posts\” – post_type \”$post_type\” | val 1″, “Test 2|val 2”, … Read more

Contact form 7 dynamic text extension – populate form with title from previous page [closed]

There are two steps to this process: 1. Make sure you have your form set up correctly. Your form should include the ‘dynamictext’ tag, and use the correct syntax as described on the plugin page. For example, you may want something like: [dynamictext theproductname “CF7_GET key=’foo'”] This will set anything after the “foo” $_GET URL … Read more

Vue.js + AJAX Shortcode

My solution was simpler than I thought…. Since I’m just trying to execute shortcodes in the frontend, I can just localize the script and pass the shortcodes as variables: functions.php wp_localize_script( ‘BUILD-script’, ‘sharedData’, array( ‘ajax_url’ => admin_url( ‘admin-ajax.php’ ), ‘mailchimpForm’ => do_shortcode(‘[mc4wp_form id=”100″]’), ‘contactForm’ => do_shortcode(‘[contact-form-7 id=”98″ title=”Contact form 1″]’) ) ); Basically I’m jus … Read more

Contact Form 7 – Populating dropdown list with terms relative to the post

Use the dynamic_dropdown tag functionality offered by the Smart Grid layout extension. The dynamic tag can take 3 sources of data (a given taxonomy, or branch within that taxonomy, a list of post titles, or the results of a filtered hook function). Use the filter hook to populated your dropdown as, add_filter(‘cf7sg_dynamic_dropdown_custom_options’, ‘filter_options’,10,3); function filter_options($options, … Read more

Transferring contact form input to an email account without using an email-proxy

The CF7 plugin uses WordPress built-in wp_mail() function which itself uses the PHPMailer class (github repo). The PHPMail github documentation states, The PHP mail() function usually sends via a local mail server, typically fronted by a sendmail binary on Linux, BSD and OS X platforms, however, Windows usually doesn’t include a local mail server; PHPMailer’s … Read more

Contact form 7 Dynamic text – placeholder on GET field

the Dynamic Text plugin cannot make what you need, but I use this code to write a new tag that you can use like that : [dynamictext_placeholder enquiry-product placeholder “placeholder text” “CF7_GET key=’product-name'” “before ‘%s’ after”] for that, create a new plugin with that : add_action( ‘wpcf7_init’, function () { wpcf7_add_form_tag( array( ‘dynamictext_placeholder’) , ‘wpcf7dtx_dynamictext_placeholder_shortcode_handler’ … Read more

How to save contact form 7 data in Custom Post Types (CPT) [closed]

If you want to save the Mail Content after the Contact Form was sent (or failed), you can use the wpcf7_mail_sent and wpcf7_mail_failed Hookes like this: add_action(‘wpcf7_mail_sent’,’save_my_form_data_to_my_cpt’); add_action(‘wpcf7_mail_failed’,’save_my_form_data_to_my_cpt’); function save_my_form_data_to_my_cpt($contact_form){ $submission = WPCF7_Submission::get_instance(); if (!$submission){ return; } $posted_data = $submission->get_posted_data(); //The Sent Fields are now in an array //Let’s say you got 4 Fields in … Read more