Guest User

Untitled

a guest
Mar 12th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.99 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. <button class="qua_contact_btn" name="contact_submit" id="contact_submit" type="submit"><?php _e('Send Message','wallstreet'); ?>
  105. <span style="display:none; color:red" id="contact_nonce_error"><?php _e('Sorry, your nonce did not verify','wallstreet');?></span>
  106. </form>
  107. </div>
  108. </div>
  109. <div id="mailsentbox" style="display:none">
  110. <div class="alert alert-success" >
  111. <strong><?php _e('Thank you','wallstreet');?></strong> <?php _e('Your information has been sent.','wallstreet');?>
  112. </div>
  113. </div>
  114.  
  115. <?php
  116. if(isset($_POST['contact_submit']))
  117. {
  118. $flag=1;
  119. if(empty($_POST['first_name']))
  120. {
  121. $flag=0;
  122. echo "<script>jQuery('#contact_user_firstname_error').show();</script>";
  123. } else
  124. if(empty($_POST['last_name']))
  125. {
  126. $flag=0;
  127. echo "<script>jQuery('#contact_user_lastname_error').show();</script>";
  128. } else
  129. if($_POST['email']=='')
  130. {
  131. $flag=0;
  132. echo "<script>jQuery('#contact_user_email_error').show();</script>";
  133. } else
  134. if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i",$_POST['email']))
  135. {
  136. $flag=0;
  137. echo "<script>jQuery('#contact_user_email_error').show();</script>";
  138. } else
  139. if($_POST['massage']=='')
  140. {
  141. $flag=0;
  142. echo "<script>jQuery('#contact_user_massage_error').show();</script>";
  143. }else
  144. if(empty($_POST) || !wp_verify_nonce($_POST['wallstreet_name_nonce_field'],'wallstreet_name_nonce_check') )
  145. {
  146. echo "<script>jQuery('#contact_nonce_error').show();</script>";
  147. exit;
  148. }
  149. else
  150. { if($flag==1)
  151. {
  152. $to = get_option('admin_email');
  153. $subject = trim($_POST['first_name']) . trim($_POST['last_name']) . get_option("blogname");
  154.  
  155. $massage =
  156. stripslashes(trim($_POST['massage']))."Message sent from:: ".trim($_POST['email'])."\nWebsite:: ".trim($_POST['website']);
  157.  
  158. $headers = "From: ".trim($_POST['first_name']).trim($_POST['last_name'])." <".trim($_POST['email']).">\r\nReply-To:".trim($_POST['email']);
  159. $website = stripslashes(trim($_POST['website']));
  160. $maildata =wp_mail($to, $subject, $massage, $headers, $website);
  161. if($maildata){
  162. echo "<script>jQuery('#myformdata').hide();</script>";
  163. echo "<script>jQuery('#mailsentbox').show();</script>";
  164. }
  165. }
  166. }
  167. }
  168. ?>
  169. </div> <!--/contact detail-->
  170. </div> <!-- /Location Map Section -->
  171. <?php get_footer(); ?>
Add Comment
Please, Sign In to add comment