' . wp_kses_post( $contactformtitle ) . '
'; } if ( isset( $email_sent ) && true === $email_sent ) { do_action( 'kt_contact_email_sent' ); ?>
ID, '_kad_contact_map', true ); $form_math = get_post_meta( $post->ID, '_kad_contact_form_math', true ); $contactformtitle = get_post_meta( $post->ID, '_kad_contact_form_title', true ); $form = get_post_meta( $post->ID, '_kad_contact_form', true ); $consent = apply_filters( 'kadence-virtue-contact-consent', false ); if ( isset( $_POST['submitted'] ) && isset( $_POST['virtue_contact_nounce'] ) ) { if ( wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['virtue_contact_nounce'] ) ), 'virtue_contact_nounce_action' ) ) { $spam_hook = apply_filters( 'kadence-contact-spam-check', true, $_POST ); if ( ! $spam_hook ) { $has_error = true; $spam_error = __( 'Your post appears to be spam, if this is incorrect please contact the site admnistator.', 'virtue-toolkit' ); } if ( isset( $form_math ) && 'yes' === $form_math ) { if ( isset( $_POST['kad_captcha'] ) && isset( $_POST['hval'] ) ) { $math_answer = trim( sanitize_text_field( wp_unslash( $_POST['kad_captcha'] ) ) ); if ( md5( $math_answer ) != sanitize_text_field( wp_unslash( $_POST['hval'] ) ) ) { $kad_captcha_error = __( 'Check your math.', 'virtue-toolkit' ); $has_error = true; } } else { $kad_captcha_error = __( 'Check your math.', 'virtue-toolkit' ); $has_error = true; } } if ( isset( $consent ) && 'true' == $consent ) { if ( isset( $_POST['gdpr-consent'] ) ) { $gdpr_consent = sanitize_text_field( wp_unslash( $_POST['gdpr-consent'] ) ); if ( 'on' != $gdpr_consent ) { $kad_consent_error = __( 'Please check the box.', 'virtue-toolkit' ); $has_error = true; } } else { $kad_consent_error = __( 'Please check the box.', 'virtue-toolkit' ); $has_error = true; } } if ( isset( $_POST['contactName'] ) && ! empty( $_POST['contactName'] ) ) { $name = trim( sanitize_text_field( wp_unslash( $_POST['contactName'] ) ) ); } else { $name_error = __( 'Please enter your name.', 'virtue-toolkit' ); $has_error = true; } if ( ! isset( $_POST['email'] ) || empty( $_POST['email'] ) ) { $email_error = __( 'Please enter your email address.', 'virtue-toolkit' ); $has_error = true; } elseif ( ! is_email( trim( sanitize_text_field( wp_unslash( $_POST['email'] ) ) ) ) ) { $email_error = __( 'You entered an invalid email address.', 'virtue-toolkit' ); $has_error = true; } else { $email = trim( sanitize_text_field( wp_unslash( $_POST['email'] ) ) ); } if ( ! isset( $_POST['comments'] ) || empty( $_POST['comments'] ) ) { $comment_error = __( 'Please enter a message.', 'virtue-toolkit' ); $has_error = true; } else { $contact_comments = wp_kses_post( wp_unslash( $_POST['comments'] ) ); } if ( ! isset( $has_error ) ) { if ( isset( $virtue['contact_email'] ) ) { $email_to = $virtue['contact_email']; } else { $email_to = get_option( 'admin_email' ); } $sitename = get_bloginfo( 'name' ); $subject = '[' . $sitename . ' ' . __( 'Contact', 'virtue-toolkit' ) . '] ' . __( 'From ', 'virtue-toolkit' ) . $name; $body = __( 'Name', 'virtue-toolkit' ) . ':' . $name . "\n\n" . 'Email:' . $email . "\n\n" . 'Comments:' . $contact_comments; $headers = 'Content-Type: text/plain; charset=UTF-8' . "\r\n"; $headers .= 'Content-Transfer-Encoding: 8bit' . "\r\n"; $headers .= 'From: ' . $name . ' <' . $email . '>' . "\r\n"; $headers .= 'Reply-To: <' . $email . '>' . "\r\n"; wp_mail( $email_to, $subject, $body, $headers ); $email_sent = true; } } } /** * @hooked virtue_page_title - 20 */ do_action( 'virtue_page_title_container' ); if ( 'yes' == $page_map ) { $address = get_post_meta( $post->ID, '_kad_contact_address', true ); $maptype = get_post_meta( $post->ID, '_kad_contact_maptype', true ); $height = get_post_meta( $post->ID, '_kad_contact_mapheight', true ); $mapzoom = get_post_meta( $post->ID, '_kad_contact_zoom', true ); if ( isset( $virtue['google_map_api'] ) && ! empty( $virtue['google_map_api'] ) ) { $gmap_api = $virtue['google_map_api']; } else { $gmap_api = ''; } if ( ! empty( $height ) ) { $mapheight = $height; } else { $mapheight = 300; } if ( ! empty( $mapzoom ) ) { $zoom = $mapzoom; } else { $zoom = 15; } if ( ! empty( $gmap_api ) ) { if ( wp_script_is( 'virtue_gmap', 'registered' ) ) { wp_enqueue_script( 'virtue_gmap' ); } ?>