File: /hosting/kak.bg/web/wp-content/themes/Primero/contact-page.php
<?php
//If the form is submitted
if(isset($_POST['submit'])) {
$to = get_progression('contact_email');
$comments = $_POST['message'];
//Check to make sure that the name field is not empty
if(trim($_POST['contactname']) == '') {
$hasError = true;
} else {
$name = trim($_POST['contactname']);
}
//Check to make sure sure that a valid email address is submitted
if(trim($_POST['email']) == '') {
$hasError = true;
} else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) {
$hasError = true;
} else {
$email = trim($_POST['email']);
}
//If there is no error, send the email
if(!isset($hasError)) {
$emailTo = $to; //Put your own email address here
$body = "Name: $name \n\nEmail: $email \n\nComments:\n $comments";
$headers = 'From: My Site <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;
mail($emailTo, 'Your Website Subject', $body, $headers);
$emailSent = true;
}
}
?>
<?php
// Template Name: Contact with sidebar
get_header(); ?>
<script type="text/javascript">
jQuery(document).ready(function($){
$("#contactform").validate();
});
</script>
<?php
if(have_posts())
while(have_posts()):
the_post();
?>
<?php if (function_exists('progression_breadcrumbs')) progression_breadcrumbs(); ?>
<div class="content-container">
<div class="sidebar-container container-<?php echo of_get_option('sidebar', 'right'); ?>">
<div class="page-content content-sidebar<?php if(of_get_option('sidebar', 'right') != 'right') echo '-'.of_get_option('sidebar', 'right'); //if statement needed to avoid css layout issues ?>">
<?php
if($post->post_parent) {
$children = wp_list_pages('sort_column=menu_order&title_li=&child_of=' . $post->post_parent . '&depth=1&echo=0');
}
else {
$children = wp_list_pages('sort_column=menu_order&title_li=&child_of=' . $post->ID . '&depth=1&echo=0');
}
if ($children) { ?>
<ul class="sub-pagination">
<?php if($post->post_parent): ?>
<li><a href='<?php echo get_permalink($post->post_parent); ?>'><?php echo get_the_title($post->post_parent); ?></a></li>
<?php else: ?>
<li class="current_page_item"><a href='<?php echo get_permalink($post->ID); ?>'><?php echo get_the_title($post->ID); ?></a></li>
<?php endif; ?>
<?php echo $children; ?>
</ul>
<?php } else { ?>
<?php } ?>
<h1 class="page-title"><?php echo $post->post_title; ?></h1>
<?php the_content(); ?>
<div id="contact-wrapper">
<?php if(isset($hasError)) { //If errors are found ?>
<p class="error">
<?php _e('Please check if you have filled all the fields with valid information. Thank you.','progressionstudios'); ?>
</p>
<?php } ?>
<?php if(isset($emailSent) && $emailSent == true) { //If email is sent ?>
<p class="success"></p>
<?php _e('Email Successfully Sent!','progressionstudios'); ?>
<p class="success2">
<?php _e('Thank you ','progressionstudios'); ?>
<strong><?php echo $name;?></strong>
<?php _e('for using my contact form! I will be in touch with you soon','progressionstudios'); ?>.
</p>
<?php } ?>
<form method="post" action="<?php echo get_permalink(); ?>" id="contactform">
<div>
<label for="name"><?php _e('Name','progressionstudios'); ?>:<span class="required">*</span></label>
<input type="text" size="28" name="contactname" id="contactname" value="" class="required" />
</div>
<div>
<label for="email"><?php _e('E-mail','progressionstudios'); ?>:<span class="required">*</span></label>
<input type="text" size="28" name="email" id="email" value="" class="required email" />
</div>
<div>
<label for="message"><?php _e('Message','progressionstudios'); ?>:</label>
<textarea rows="10" cols="38" name="message" id="message"></textarea>
</div>
<input type="submit" value="<?php _e('Send Message ','progressionstudios'); ?>" name="submit" class="button" />
</form>
</div><!-- close #contact-wrapper -->
<div class="clearfix"></div>
</div><!-- close .page-content -->
<?php get_template_part( 'pages-sidebar' ); ?>
<!--div class="clearfix"></div-->
</div><!-- close .sidebar-container -->
</div><!-- close .content-container -->
<div class="content-container-base">
<div class="side-bar-base side-bar-base-<?php echo of_get_option('sidebar', 'right'); ?>"></div>
</div><!-- close .content-container-base or .content-container-base-pagination -->
<?php
endwhile;
?>
<?php get_footer(); ?>