-
Author
-
February 4, 2016 at 07:22 #102018monclParticipant
Dear seventhqueen.
I use the quick contact menu in kleo theme.
Can i add another email address to quick contact receiver?
I attached the picture.
now i use the codes below.
kleo-child>functions.php.
if (!function_exists(‘kleo_contact_form’)) {
function kleo_contact_form( $atts, $content = null ) {
extract(shortcode_atts(array(
‘title’ => ‘CONTACT US’
), $atts));
$output = ”;
$output .= ‘<div class=”kleo-quick-contact-wrapper”>’
.'<a class=”kleo-quick-contact-link” href=”#” rel=”nofollow”><i class=”icon-mail-alt”></i></a>’
.'<div id=”kleo-quick-contact”>’
.'<h4 class=”kleo-qc-title”>’. $title .'</h4>’
.'<p>’. do_shortcode($content).'</p>’
.'<form class=”kleo-contact-form” action=”#” method=”post” novalidate>’
.'<input type=”text” placeholder=”‘.__(“이름/연락처(필수)”,’kleo_framework’).'” required id=”contact_name” name=”contact_name” class=”form-control” value=”” tabindex=”276″ />’
.'<input type=”email” required placeholder=”‘ . __(“이메일”,’kleo_framework’) . ‘” id=”contact_email” name=”contact_email” class=”form-control” value=”” tabindex=”277″ />’
.'<textarea placeholder=”‘ . __(“문의내용”,’kleo_framework’) . ‘” required id=”contact_content” name=”contact_content” class=”form-control” tabindex=”278″></textarea>’
.'<input type=”hidden” name=”action” value=”kleo_sendmail”/>’
.'<button tabindex=”279″ class=”btn btn-default pull-right” type=”submit”>’. __(“Send”,’kleo_framework’).'</button>’
.'<div class=”kleo-contact-loading”>’. __(“Sending”,’kleo_framework’).’ <i class=”icon-spinner icon-spin icon-large”></i></div>’
.'<div class=”kleo-contact-success”> </div>’
.'</form>’
.'<div class=”bottom-arrow”></div>’
.'</div>’
.'</div><!–end kleo-quick-contact-wrapper–>’;
return $output;
}
add_shortcode(‘kleo_contact_form’, ‘kleo_contact_form’);
}
Attachments:
You must be logged in to view attached files.February 4, 2016 at 15:38 #102116sharmstrModeratorThat’s not the correct code. That’s the form code, not the code that actually sends the email. This is the code that sends it
COPY CODEfunction kleo_sendmail() { if(isset($_POST['action'])) { $error_tpl = "<span class='mail-error'>%s</span>"; //contact name if(trim($_POST['contact_name']) === '') { printf($error_tpl, __('Please enter your name.','kleo_framework') ); die(); } else { $name = trim($_POST['contact_name']); } ///contact email if(trim($_POST['contact_email']) === '') { printf($error_tpl, __('Please enter your email address.','kleo_framework') ); die(); } elseif (!preg_match("/^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+.[a-z]{2,4}$/i", trim($_POST['contact_email']))) { printf($error_tpl, __('You entered an invalid email address.','kleo_framework') ); die(); } else { $email = trim($_POST['contact_email']); } //message if(trim($_POST['contact_content']) === '') { printf($error_tpl, __('Please enter a message.','kleo_framework') ); die(); } else { if(function_exists('stripslashes')) { $comment = stripslashes(trim($_POST['contact_content'])); } else { $comment = trim($_POST['contact_content']); } } $emailTo = sq_option('contact_form_to',''); if (!isset($emailTo) || ($emailTo == '') ) { $emailTo = get_option('admin_email'); } $subject = __( 'Contact Form Message', 'kleo_framework' ); apply_filters( 'kleo_contact_form_subject', $subject ); $body = __("You received a new contact form message:", 'kleo_framework') . "\n"; $body .= __("Name: ", 'kleo_framework') . $name . "\n"; $body .= __("Email: ", 'kleo_framework') .$email . "\n" ; $body .= __("Message: ", 'kleo_framework') . $comment . "\n"; $headers[] = "Content-type: text/html"; $headers[] = "Reply-To: $name <$email>"; apply_filters('kleo_contact_form_headers',$headers); if(wp_mail($emailTo, $subject, $body, $headers)) { echo '<span class="mail-success">' . __("Thank you. Your message has been sent.", 'kleo_framework').' <i class="icon-ok icon-large"></i></span>'; do_action('kleo_after_contact_form_mail_send', $name, $email, $comment); } else { printf($error_tpl, __("Mail couldn't be sent. Please try again!",'kleo_framework') ); } } else { printf($error_tpl, __("Unknown error occurred. Please try again!",'kleo_framework') ); } die(); }
Change $emailTo to whatever emails address you want. https://developer.wordpress.org/reference/functions/wp_mail/
I will say the better way to do this is set up a forwarding address on your email server that will forward a copy of the email to whoever you want.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
-
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.