Estaba buscando exactamente esto y lo hice funcionar de otra manera para mí bien. Hacer dos campos, como a continuación en el formulario de contacto-7 campos ..
[email* email placeholder "Email"]
[email* email-confirm placeholder "Confirm Email"]
copiar/pegar el código php a continuación en el archivo functions.php
function register_scripts() {
if (!is_admin()) {
// include your script
wp_enqueue_script('email-confirm', get_bloginfo('template_url') . '/js/email-confirm.js');
}
}
add_action('wp_enqueue_scripts', 'register_scripts');
asegúrese de cambiar la ruta de archivo para que coincida y cargue un archivo js con el siguiente código en ese directorio de ruta.
// First we trigger the form submit event
jQuery(document).ready(function() {
jQuery('.wpcf7-submit').click(function() {
// We remove the error to avoid duplicate errors
jQuery('.error').remove();
// We create a variable to store our error message
var errorMsg = jQuery('<span class="error">Your emails do not match.</span>');
// Then we check our values to see if they match
// If they do not match we display the error and we do not allow form to submit
if (jQuery('.email').find('input').val() !== jQuery('.email-confirm').find('input').val()) {
errorMsg.insertAfter(jQuery('.email-confirm').find('input'));
return false;
} else {
// If they do match we remove the error and we submit the form
jQuery('.error').remove();
return true;
}
});
});
Lo he usado en mi sitio y funciona bien. Espero que esto ayude a alguien como yo.
Referencia: Contact Form 7 Verify Email
intenta agregar dos entradas de correo electrónico, a continuación, escribir una pequeña alforja en el pie de página para comprobar si son la mismo. – Constantin
– Constantin