Guest User

Untitled

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