Guest User

Untitled

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