Guest User

Untitled

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