Guest User

Untitled

a guest
Oct 4th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.40 KB | None | 0 0
  1. <?php
  2. //Template Name: Contact Us
  3. /**
  4. * @Theme Name : Wallstreet-Pro
  5. * @file : contact-us.php
  6. * @package : wallstreet-Pro
  7. @author : webriti
  8. * @filesource : wp-content/themes/wallstreet/contact-us.php
  9. */
  10. get_header(); ?>
  11. <?php $wallstreet_pro_options=theme_data_setup();
  12. $current_options = wp_parse_args( get_option( 'wallstreet_pro_options', array() ), $wallstreet_pro_options );
  13. $mapsrc= $current_options['contact_google_map_url'];
  14. $mapsrc=$mapsrc.'&amp;output=embed';
  15. ?>
  16. <!-- Page Title Section -->
  17. <div class="page-mycarousel" style='background: url("<?php echo( get_header_image() ); ?>") repeat scroll center 0 #143745;'>
  18. <div class="page-title-col">
  19. <div class="container">
  20. <div class="row">
  21. <div class="page-header-title">
  22. <h1><?php the_title(); ?></h1>
  23. </div>
  24. </div>
  25. </div>
  26. <?php get_template_part('index', 'banner'); ?>
  27. </div>
  28. </div>
  29. <!-- /Page Title Section -->
  30. <!-- Location Map Section -->
  31. <div class="qua_contact_area">
  32. <div class="google-map-title">
  33. <?php if($current_options['contact_google_map_title']) { ?>
  34. <h1><?php echo $current_options['contact_google_map_title']; ?></h1>
  35. <?php } ?>
  36. </div>
  37. <div>
  38. <div class="container">
  39.  
  40. <div class="row contact-detail-section">
  41. <?php if($current_options['contact_address_settings'] == "on"){ ?>
  42. <div class="col-md-4">
  43. <div class="contact-detail-area">
  44. <span><i class="fa <?php if($current_options['contact_address_icon']) { echo $current_options['contact_address_icon']; } ?>"></i></span>
  45. <?php if($current_options['contact_address_title']) { ?>
  46. <h5><?php echo $current_options['contact_address_title']; ?></h5>
  47. <?php } ?>
  48. <address><?php if($current_options['contact_address_designation_one']) { echo $current_options['contact_address_designation_one']; } ?> </address>
  49. <address><?php if($current_options['contact_address_designation_two']) { echo $current_options['contact_address_designation_two']; } ?> </address>
  50. </div>
  51. </div>
  52. <?php } ?>
  53. <?php if($current_options['contact_phone_settings'] == "on"){ ?>
  54. <div class="col-md-4">
  55. <div class="contact-detail-area">
  56. <span><i class="fa <?php if($current_options['contact_phone_icon']) { echo $current_options['contact_phone_icon']; } ?>"></i></span>
  57. <?php if($current_options['contact_phone_title']) { ?>
  58. <h5><?php echo $current_options['contact_phone_title']; ?></h5>
  59. <?php } ?>
  60. <address><?php if($current_options['contact_phone_number_one']) { echo $current_options['contact_phone_number_one']; } ?></address>
  61. <address><?php if($current_options['contact_phone_number_two']) { echo $current_options['contact_phone_number_two']; } ?></address>
  62. </div>
  63. </div>
  64. <?php } ?>
  65. <?php if($current_options['contact_email_settings'] == "on"){ ?>
  66. <div class="col-md-4">
  67. <div class="contact-detail-area">
  68. <span><i class="fa <?php if($current_options['contact_email_icon']) { echo $current_options['contact_email_icon']; } ?>"></i></span>
  69. <?php if($current_options['contact_email_title']) { ?>
  70. <h5><?php echo $current_options['contact_email_title']; ?></h5>
  71. <?php } ?>
  72. <address><?php if($current_options['contact_email_number_one']) { echo $current_options['contact_email_number_one']; } ?></address>
  73. <address><?php if($current_options['contact_email_number_two']) { echo $current_options['contact_email_number_two']; } ?></address>
  74. </div>
  75. </div>
  76. <?php } ?>
  77. </div>
  78.  
  79. </div>
  80. <div class="qua_contact_area">
  81.  
  82.  
  83. <?php if($current_options['contact_google_map_enabled'] == "on"){ ?>
  84.  
  85. <div class="qua_google_map">
  86. <iframe width="100%" scrolling="no" height="500" frameborder="0" src="<?php echo esc_url($mapsrc); ?>" marginwidth="0" marginheight="0"></iframe>
  87. </div>
  88. <?php } ?>
  89. <!--contact detail-->
  90. <div class="container">
  91.  
  92.  
  93. <div class="row contact-form-section" id="myformdata">
  94. <?php the_post(); ?>
  95. <?php echo the_content(); ?>
  96. <div class="col-md-12">
  97. <div class="cont-heading-title">
  98. <?php if($current_options['contact_form_title']) { ?>
  99. <h1><?php echo $current_options['contact_form_title']; ?></h1>
  100. <?php } ?>
  101. <?php if($current_options['contact_form_description']) { ?>
  102. <p><?php echo $current_options['contact_form_description']; ?></p>
  103. <?php } ?>
  104. </div>
  105. <form role="form" class="form-inline" method="post" action="#">
  106. <?php wp_nonce_field('wallstreet_name_nonce_check','wallstreet_name_nonce_field'); ?>
  107. <div class="cont-form-group">
  108. <input type="name" id="first_name" name="first_name" placeholder="<?php echo __( 'First name', 'wallstreet' ); ?>" class="blog-form-control">
  109. <span style="display:none; color:red" id="contact_user_firstname_error"><?php _e('First name','wallstreet'); ?> </span>
  110. </div>
  111. <div class="cont-form-group">
  112. <input type="name" id="last_name" name="last_name" placeholder="<?php echo __( 'Last name', 'wallstreet' ); ?>" class="blog-form-control">
  113. <span style="display:none; color:red" id="contact_user_lastname_error"><?php _e('Last name','wallstreet'); ?> </span>
  114. </div>
  115. <div class="cont-form-group">
  116. <input type="email" id="email" name="email" placeholder="<?php echo __( 'Email', 'wallstreet' ); ?>" class="blog-form-control">
  117. <span style="display:none; color:red" id="contact_user_email_error"><?php _e('Email','wallstreet'); ?> </span>
  118. </div>
  119. <div class="cont-form-group">
  120. <input type="text" id="website" name="website" placeholder="<?php echo __( 'Website', 'wallstreet' ); ?>" class="blog-form-control">
  121. <span style="display:none; color:red" id="contact_user_website_error"><?php _e('Website','wallstreet'); ?> </span>
  122. </div>
  123. <div class="cont-form-group-textarea">
  124. <textarea placeholder="<?php echo __( 'Message', 'wallstreet' ); ?>" class="cont-form-control-textarea" id="massage" name="massage" rows="5"></textarea>
  125. <span style="display:none; color:red" id="contact_user_massage_error"><?php _e('Message','wallstreet'); ?> </span>
  126. </div>
  127. <button class="qua_contact_btn" name="contact_submit" id="contact_submit" type="submit"><?php _e('Send Message','wallstreet'); ?>
  128. <span style="display:none; color:red" id="contact_nonce_error"><?php _e('Sorry, your nonce did not verify','wallstreet');?></span>
  129. </form>
  130. </div>
  131. </div>
  132. <div id="mailsentbox" style="display:none">
  133. <div class="alert alert-success" >
  134. <strong><?php _e('Thank you','wallstreet');?></strong> <?php _e('Your information has been sent.','wallstreet');?>
  135. </div>
  136. </div>
  137.  
  138. <?php
  139. if(isset($_POST['contact_submit']))
  140. {
  141. $flag=1;
  142. if(empty($_POST['first_name']))
  143. {
  144. $flag=0;
  145. echo "<script>jQuery('#contact_user_firstname_error').show();</script>";
  146. } else
  147. if(empty($_POST['last_name']))
  148. {
  149. $flag=0;
  150. echo "<script>jQuery('#contact_user_lastname_error').show();</script>";
  151. } else
  152. if($_POST['email']=='')
  153. {
  154. $flag=0;
  155. echo "<script>jQuery('#contact_user_email_error').show();</script>";
  156. } else
  157. if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i",$_POST['email']))
  158. {
  159. $flag=0;
  160. echo "<script>jQuery('#contact_user_email_error').show();</script>";
  161. } else
  162. if($_POST['massage']=='')
  163. {
  164. $flag=0;
  165. echo "<script>jQuery('#contact_user_massage_error').show();</script>";
  166. }else
  167. if(empty($_POST) || !wp_verify_nonce($_POST['wallstreet_name_nonce_field'],'wallstreet_name_nonce_check') )
  168. {
  169. echo "<script>jQuery('#contact_nonce_error').show();</script>";
  170. exit;
  171. }
  172. else
  173. { if($flag==1)
  174. {
  175. $to = get_option('admin_email');
  176. $subject = trim($_POST['first_name']) . trim($_POST['last_name']) . get_option("blogname");
  177. $massage = stripslashes(trim($_POST['massage']))."Message sent from:: ".trim($_POST['email']);
  178. $headers = "From: ".trim($_POST['first_name']).trim($_POST['last_name'])." <".trim($_POST['email']).">\r\nReply-To:".trim($_POST['email']);
  179. $website = stripslashes(trim($_POST['website']));
  180. $maildata =wp_mail($to, $subject, $massage, $headers, $website);
  181. if($maildata){
  182. echo "<script>jQuery('#myformdata').hide();</script>";
  183. echo "<script>jQuery('#mailsentbox').show();</script>";
  184. }
  185. }
  186. }
  187. }
  188. ?>
  189. </div> <!--/contact detail-->
  190. </div> <!-- /Location Map Section -->
  191. <?php get_footer(); ?>
Add Comment
Please, Sign In to add comment