Home › Forums › All Other Themes › How to change who the sidebar contact forms go to
- This topic has 9 replies, 3 voices, and was last updated 6 years, 8 months ago by Sonl Sinha.
-
AuthorPosts
-
April 10, 2018 at 2:29 pm #98816
The theme SKT Architect Pro has the “default template” pages set up to include a right sidebar with a contact form. How do we change who these contact forms go to?
I did not see contact form under widgets.April 11, 2018 at 7:42 am #98851Hi,
Kindly show us your website URL?
Regards,
BradApril 11, 2018 at 1:18 pm #98900https://lailta.org/
April 12, 2018 at 7:48 am #98936Hi,
Kindly go to >> inc/custom-functions.php and find text “Contact Form” and change there.
Regards,
BradApril 12, 2018 at 3:52 pm #98964Hello thank you. I found the reference to the contact form in that file, but I am unsure where to place the actual recipient emails?
I attempted to replace ‘admin_email’ on the third line here with my email address and then tested the form, but I received nothing. I am also unsure why it wouldn’t send to the admin email (mine) in the first place.
function contactform_func( $atts ) {
$atts = shortcode_atts( array(
‘to_email’ => get_bloginfo(‘admin_email’),
‘title’ => ‘Contact enquiry – ‘.home_url( ‘/’ ),
), $atts );$cform = “<div class=\”main-form-area\” id=\”contactform_main\”>”;
$cerr = array();
if( isset($_POST[‘c_submit’]) && $_POST[‘c_submit’]==’Submit’ ){
$name = trim( $_POST[‘c_name’] );
$email = trim( $_POST[‘c_email’] );
$phone = trim( $_POST[‘c_phone’] );
$website = trim( $_POST[‘c_website’] );
$comments = trim( $_POST[‘c_comments’] );
$captcha = trim( $_POST[‘c_captcha’] );
$captcha_cnf = trim( $_POST[‘c_captcha_confirm’] );if( !$name )
$cerr[‘name’] = ‘Please enter your name.’;
if( ! filter_var($email, FILTER_VALIDATE_EMAIL) )
$cerr[’email’] = ‘Please enter a valid email.’;
if( !$phone )
$cerr[‘phone’] = ‘Please enter your phone number.’;
if( !$comments )
$cerr[‘comments’] = ‘Please enter your message.’;
if( !$captcha || (md5($captcha) != $captcha_cnf) )
$cerr[‘captcha’] = ‘Please enter the correct answer.’;if( count($cerr) == 0 ){
$subject = $atts[‘title’];
$headers = “From: “.$name.” <” . strip_tags($email) . “>\r\n”;
$headers .= “MIME-Version: 1.0\r\n”;
$headers .= “Content-type: text/html; charset=iso-8859-1\r\n”;$message = ‘<html><body>
<table>
<tr><td>Name: </td><td>’.$name.'</td></tr>
<tr><td>Email: </td><td>’.$email.'</td></tr>
<tr><td>Phone: </td><td>’.$phone.'</td></tr>
<tr><td>Website: </td><td>’.$website.'</td></tr>
<tr><td>Message: </td><td>’.$comments.'</td></tr>
</table>
</body>
</html>’;
mail( $atts[‘to_email’], $subject, $message, $headers);
$cform .= ‘<div class=”success_msg”>Thank you! A representative will get back to you very shortly.</div>’;
unset( $name, $email, $phone, $website, $comments, $captcha );
}else{
$cform .= ‘<div class=”error_msg”>’;
$cform .= implode(‘<br />’,$cerr);
$cform .= ‘</div>’;
}
}$capNum1 = rand(1,4);
$capNum2 = rand(1,5);
$capSum = $capNum1 + $capNum2;
$sumStr = $capNum1.” + “.$capNum2 .” = “;$cform .= “<form name=\”contactform\” action=\”#contactform_main\” method=\”post\”>
<p><input type=\”text\” name=\”c_name\” value=\””. ( ( empty($name) == false ) ? $name : “” ) .”\” placeholder=\”Name\” /></p>
<p><input type=\”email\” name=\”c_email\” value=\””. ( ( empty($email) == false ) ? $email : “” ) .”\” placeholder=\”Email\” /></p><div class=\”clear\”></div>
<p><input type=\”tel\” name=\”c_phone\” value=\””. ( ( empty($phone) == false ) ? $phone : “” ) .”\” placeholder=\”Phone\” /></p>
<p><input type=\”url\” name=\”c_website\” value=\””. ( ( empty($website) == false ) ? $website : “” ) .”\” placeholder=\”Website with prefix http://\” /></p><div class=\”clear\”></div>
<p><textarea name=\”c_comments\” placeholder=\”Message\”>”. ( ( empty($comments) == false ) ? $comments : “” ) .”</textarea></p><div class=\”clear\”></div>”;
$cform .= “<p><span class=\”capcode\”>$sumStr</span><input type=\”text\” placeholder=\”Captcha\” value=\””. ( ( empty($captcha) == false ) ? $captcha : “” ) .”\” name=\”c_captcha\” /><input type=\”hidden\” name=\”c_captcha_confirm\” value=\””. md5($capSum).”\”></p><div class=\”clear\”></div>”;
$cform .= “<p class=\”sub\”><input type=\”submit\” name=\”c_submit\” value=\”Submit\” class=\”search-submit\” /></p>
</form>
</div>”;return $cform;
}
add_shortcode( ‘contactform’, ‘contactform_func’ );April 13, 2018 at 5:44 am #98991Hi,
Do you want to change Email Address or form fields?
Regards,
BradApril 13, 2018 at 1:35 pm #99049I’d like to know how to edit both the form fields and the email addresses this form is going to if possible, but my main question was how do I know who this email is going to/how do I change it or add more recipients.
April 16, 2018 at 5:36 am #99108Hi,
You can point the default form that comes on the sidebar to email address of admin which is given in WordPress admin>settings>general.
In case you want to replace the form with some other fields without handling code then here’s a method:
Kindly use page template full wide in pages>edit>right sidebar under page attributes>select full width template to have no sidebar. Or else go to appearance>widgets and then add some contact form plugin widget in page sidebar area to get rid of the default contact form widget and instead show what you add there.
Regards,
ShriApril 16, 2018 at 1:34 pm #99252Hello,
Thank you for your reply. As mentioned my, email is set up as the admin email to receive notifications through the site (which I already added under Admin>settings>General>”Email Address” when the site was set up).
Upon sending a test email through the form multiple times, I received nothing (also not in my spam folder). We would also like to have this contact form go to more than one email.
Is there a way to figure out why nothing is happening?
April 17, 2018 at 12:40 pm #99318Hi,
Kindly use this plugin: https://wordpress.org/plugins/contact-form-7/
Regards,
Brad -
AuthorPosts
- You must be logged in to reply to this topic.