-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontact.php
107 lines (89 loc) · 3.07 KB
/
contact.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
/*
Template Name: Contact
*/
?>
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if (!of_get_option('contact_form') ) {
$this_form_spam = $_POST['title'];
if ($this_form_spam == "")
{
if(isset($_POST['submitted'])) {
$name = trim($_POST['contactName']);
$email = trim($_POST['email']);
$comments = trim($_POST['comments']);
$emailTo = get_option('tz_email');
if (!isset($emailTo) || ($emailTo == '') ){
$emailTo = get_option('admin_email');
}
$subject = 'Website Enquiry';
$body = "Name: $name \n\nEmail: $email \n\nComments: $comments";
$headers = 'From: '.$name.' <'.$email.'>' . "\r\n" . 'Reply-To: ' . $email;
mail($emailTo, $subject, $body, $headers);
$emailSent = true;
}
}
}
?>
<?php get_header(); ?>
<div class="row">
<div class="sixteen columns">
<div class="section half-bottom">
<?php the_title( '<h1>', '</h1>' ); ?>
</div>
</div>
</div>
<?php if (!of_get_option('contact_form') ) { ?>
<div class="row">
<div class="ten columns">
<div class="section remove-top">
<?php if(isset($emailSent) && $emailSent == true) { ?>
<div class="thanks">
<p>Thanks, we will get in touch shortly.</p>
</div>
<?php } else { ?>
<?php if(isset($hasError) || isset($captchaError)) { ?>
<p class="error">Sorry, an error occured.<p>
<?php } ?>
<?php } ?>
<form action="<?php echo home_url(); ?>/contact" id="contactForm" class="custom-form" method="post">
<div>
<input type="text" id="title" name="title" value="" />
<label for="contactName">Name</label>
<input type="text" name="contactName" id="contactName" value="<?php if(isset($_POST['contactName'])) echo $_POST['contactName'];?>" class="required" />
</div>
<div>
<label for="email">Email</label>
<input type="text" name="email" id="email" value="<?php if(isset($_POST['email'])) echo $_POST['email'];?>" class="required email" />
</div>
<div>
<label for="commentsText">Message:</label>
<textarea name="comments" id="commentsText"><?php if(isset($_POST['comments'])) { if(function_exists('stripslashes')) { echo stripslashes($_POST['comments']); } else { echo $_POST['comments']; } } ?></textarea>
</div>
<button type="submit"><span>Send</span></button>
<input type="hidden" name="submitted" id="submitted" value="true" />
</form>
</div>
</div>
<div class="five columns offset-by-one">
<div class="section remove-top">
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<?php the_content(''); ?>
<?php endwhile; endif; ?>
</div>
</div>
</div>
<?php } else { ?>
<div class="row">
<div class="sixteen columns">
<div class="section remove-top">
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<?php the_content(''); ?>
<?php endwhile; endif; ?>
</div>
</div>
<div>
<?php } ?>
<?php get_template_part( 'testimonials' ); ?>
<?php get_footer(); ?>