Contact form 7 post loop [closed]
You could always do something like this: echo do_shortcode( ‘[contact-form-7 id=”23″ title=”Contact form 1″]’ ); And put that anywhere in your theme to display it. Docs: do_shortcode
You could always do something like this: echo do_shortcode( ‘[contact-form-7 id=”23″ title=”Contact form 1″]’ ); And put that anywhere in your theme to display it. Docs: do_shortcode
Without any coding you can use the Contact Form 7 to Database Extension plugin which has the ability to export the posted data as CSV. And if you are up for some coding then you can hook the wpcf7_before_send_mail action hook with your own function to create the csv form the $_POST data and sent … Read more
Could somebody explain why it’s advised never to load wp-admin/admin.php in your plugin and how it could cause issues? Because it is loading WordPress out of context– well, parts of WordPress. And that can cause unexpected effects such as functions not being loaded or functions being loaded twice (which will cause fatal errors). You will … Read more
Since the recaptcha is created by contact form 7 without assigning the rendered recaptcha to a variable it was not possible to use grecaptcha.reset(opt_widget_id). Here is what is did: $(“.wpcf7-submit”).click(function(event) { var currentForm=$(this).closest(“form”); $( document ).ajaxComplete(function(event,request, settings) { var responseObj=JSON.parse(request.responseText); if(responseObj.mailSent==true){ //reset recaptcha var recaptchaIFrame=currentForm.find(“iframe”).eq(0); var recaptchaIFrameSrc=recaptchaIFrame.attr(“src”); recaptchaIFrame.attr(“src”,recaptchaIFrameSrc); } }); }); I have cleared the … Read more
You can’t do that directly inside the CF7 plugin you need to modify the CSS. Add the following to your theme’s style.css file: .wpcf7-recaptcha > div { margin: 0 0 15px auto; } PLEASE BE NOTED: If you add the above code, it will take effect to all your recaptcha fields in every forms on … Read more
In the first step, the form to display, you can keep what you have coded. Then you can do that to generate the result in the e-mail : add_filter(“wpcf7_posted_data”, function ($posted_data) { $result = “”; foreach ($posted_data[“tag”] as $index => $question) { $answer = $posted_data[“ans”][$index]; $result .= “$question : $answer\n”; } $posted_data[“my_questions”] = $result; return … Read more
Yes, you can add your own custom validation. More info here. Here’s a working and tested example for your situation: Use [text* your-website] inside your contact form 7 form. Add this snippet to your theme’s functions.php, use a child-theme! add_filter( ‘wpcf7_validate_text*’, ‘custom_website_validation_filter’, 20, 2 ); function custom_website_validation_filter( $result, $tag ) { if ( $tag->name == … Read more
I’d put the dequeue statements inside the ‘if’, replacing the $loadscripts line. No need to set the flag and then check the flag to dequeue. That might simplify the code for further debugging. Edited: suggested code corrections: function contactform_dequeue_scripts() { if (is_singular()) { $post = get_post(); if (has_shortcode($post->post_content, ‘contact-form-7’)) { wp_dequeue_script(‘contact-form-7’); wp_dequeue_script(‘google-recaptcha’); wp_dequeue_style(‘contact-form-7’); } } … Read more
You know the id of the form from the shortcode, you can do stuff just for that particular form. Here’s some sample code for that, just replace $myform_id with your form id: add_action( ‘wpcf7_mail_sent’, ‘wp190913_wpcf7’ ); /** * Do stuff for my contact form form. This function shouldn’t return aything * * @param WPCF7_ContactForm $contact_form … Read more
Thanks @Judd Franklin for the directions. I was also missing $submission->uploaded_files();. Here is the working code for those who are looking for the same answer: function image_form_to_featured_image( $contact_form ) { $submission = WPCF7_Submission::get_instance(); $posted_data = $submission->get_posted_data(); // Creating a new post with contact form values $args = array( ‘post_type’ => ‘projects’, ‘post_status’=> ‘draft’, ‘post_title’=> wp_strip_all_tags( … Read more