We bought this theme called "Classiera" but the contact us functions just doesnt work... we've set up the SMTP plugin and it works when tested
we use loco translate to translate some of it fast, but i couldnt suspect it interferring with the websites code, only what the user agent sees, right? something wrong with this code??
Ask for the full template website code if needed <3
if(isset($_POST['submitted'])) {
//Check to make sure that the name field is not empty
if(trim($_POST['contactName']) === '') {
$nameError = $classieraContactNameError;
$hasError = true;
} elseif(trim($_POST['contactName']) === 'Name*') {
$nameError = $classieraContactNameError;
$hasError = true;
} else {
$name = trim($_POST['contactName']);
}
//Check to make sure that the subject field is not empty
if(trim($_POST['subject']) === '') {
$subjectError = $classiera_contact_subject_error;
$hasError = true;
} elseif(trim($_POST['subject']) === 'Subject*') {
$subjectError = $classiera_contact_subject_error;
$hasError = true;
} else {
$subject = trim($_POST['subject']);
}
//Check to make sure sure that a valid email address is submitted
if(trim($_POST['email']) === '') {
$emailError = $classieraContactEmailError;
$hasError = true;
} else if (!preg_match("/^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$/i", trim($_POST['email']))) {
$emailError = $classieraContactEmailError;
$hasError = true;
} else {
$email = trim($_POST['email']);
}
//Check to make sure comments were entered
if(trim($_POST['comments']) === '') {
$commentError = $classieraConMsgError;
$hasError = true;
} else {
if(function_exists('stripslashes')) {
$comments = stripslashes(trim($_POST['comments']));
} else {
$comments = trim($_POST['comments']);
}
}
//Check to make sure that the human test field is not empty
$classieraCheckAnswer = $_POST['humanAnswer'];
if(trim($_POST['humanTest']) != $classieraCheckAnswer) {
$humanTestError = esc_html__('Not Human', 'classiera');
$hasError = true;
} else {
}
//If there is no error, send the email
if(!isset($hasError)) {
$emailTo = $contact_email;
$subject = $subject;
$body = "Name: $name \n\nEmail: $email \n\nComments: $comments";
$headers = 'From website <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;
wp_mail($emailTo, $subject, $body, $headers);
$emailSent = true;
}
}