Guest User

Untitled

a guest
Jan 30th, 2019
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.83 KB | None | 0 0
  1. <?php
  2. /**
  3. Template Name: Contact
  4. */
  5. get_header();
  6. get_template_part('index','banner');
  7.  
  8. $appointment_options=theme_setup_data();
  9. $contact_setting = wp_parse_args( get_option( 'appointment_options', array() ), $appointment_options );
  10. //echo "<pre>"; print_r($contact_setting); wp_die();
  11. $mapsrc= $contact_setting['contact_google_map_url'];
  12. $mapsrc=$mapsrc.'&amp;output=embed';
  13. ?>
  14. <!-- Contact Section -->
  15. <div class="page-builder">
  16. <div class="container">
  17. <div class="row">
  18. <div class="col-md-12">
  19. <?php
  20. the_post();
  21. the_content();?>
  22. </div>
  23. </div>
  24.  
  25. <div class="row">
  26.  
  27. <!--Contact Form-->
  28. <?php if( $contact_setting['contact_google_map_enabled'] == 1) { ?>
  29. <div class="col-md-12"><?php } else { ?><div class="col-md-8"><?php } ?>
  30. <div id="mailsentbox" style="display:none">
  31. <div class="alert alert-success" >
  32. <strong><?php _e('Thank you','appointment');?></strong> <?php _e('Your information has been sent.','appointment');?>
  33. </div>
  34. </div>
  35.  
  36. <div class="contact-title"><h2><?php echo $contact_setting['send_usmessage']; ?></h2></div>
  37.  
  38.  
  39. <div class="contact-form-section" id="myformdata">
  40. <form class="form-inline" role="form" method="post" action="#">
  41. <?php wp_nonce_field('appointment_name_nonce_check','appointment_name_nonce_field'); ?>
  42. <div class="contact-form-group">
  43. <input type="name" name="user_name" id="user_name" placeholder="<?php _e('Name','appointment'); ?>" class="contact-form-control">
  44. <span style="display:none; color:red" id="contact_user_name_error"><?php _e('Name','appointment'); ?> </span>
  45. </div>
  46. <div class="contact-form-group">
  47. <input type="email" name="user_email" id="user_email" placeholder="<?php _e('Email','appointment'); ?>" class="contact-form-control">
  48. <span style="display:none; color:red" id="contact_user_email_error"><?php _e('Email','appointment'); ?> </span>
  49. </div>
  50. <div class="contact-form-group-textarea">
  51. <textarea placeholder="<?php _e('Message','appointment'); ?>" name="user_massage" id="user_massage" class="contact-form-control-textarea" rows="7"></textarea>
  52. <span style="display:none; color:red" id="contact_user_massage_error"><?php _e('Message','appointment'); ?></span>
  53. </div>
  54. <button class="blogdetail-btn" id="contact_submit" name="contact_submit" type="submit"><?php _e('Send Message', 'appointment'); ?></button>
  55. </form>
  56. </div>
  57. </div>
  58. <!--/Contact Form-->
  59. <?php
  60. if(isset($_POST['contact_submit']))
  61. {
  62. $flag=1;
  63. if(empty($_POST['user_name']))
  64. {
  65.  
  66. $flag=0;
  67. echo "<script>jQuery('#contact_user_name_error').show();</script>";
  68. } else
  69. if($_POST['user_email']=='')
  70. {
  71. $flag=0;
  72. echo "<script>jQuery('#contact_user_email_error').show();</script>";
  73. } else
  74. if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i",$_POST['user_email']))
  75. {
  76. $flag=0;
  77. echo "<script>jQuery('#contact_user_email_error').show();</script>";
  78. } else
  79. if($_POST['user_massage']=='')
  80. {
  81. $flag=0;
  82. echo "<script>jQuery('#contact_user_massage_error').show();</script>";
  83. }else
  84. if(empty($_POST) || !wp_verify_nonce($_POST['appointment_name_nonce_field'],'appointment_name_nonce_check') )
  85. {
  86. echo "<script>jQuery('#contact_nonce_error').show();</script>";
  87. exit;
  88. }
  89. else
  90. {
  91.  
  92. if($flag==1)
  93. {
  94. $to = get_option('admin_email');
  95. //print_r($to);
  96. $subject = trim($_POST['user_name']) . get_option("blogname");
  97. $massage = stripslashes(trim($_POST['user_massage']))."Message sent from:: ".trim($_POST['user_email']);
  98. $headers = "From: ".trim($_POST['user_name'])." <".trim($_POST['user_email']).">\r\nReply-To:".trim($_POST['user_email']);
  99. $maildata =wp_mail($to, $subject, $massage, $headers);
  100. if($maildata){
  101. echo "<script>jQuery('#myformdata').hide();</script>";
  102. echo "<script>jQuery('#mailsentbox').show();</script>";
  103. }
  104. }
  105. }
  106. }
  107. ?>
  108.  
  109. <!--Google Map-->
  110. <?php if( $contact_setting['contact_google_map_enabled'] == 0) { ?>
  111. <div class="col-md-4">
  112. <div class="contact-title"><h2><?php echo $contact_setting['contact_google_title'];?></h2></div>
  113. <div class="google-map">
  114. <iframe width="100%" scrolling="no" height="285" frameborder="0" marginheight="0" marginwidth="0" src="<?php echo esc_url($mapsrc); ?>"></iframe>
  115. </div>
  116. </div>
  117. <?php } ?>
  118. <!--Google Map-->
  119.  
  120.  
  121. </div>
  122.  
  123. </div>
  124. </div>
  125. <!-- /Contact Section -->
  126.  
  127. <div class="clearfix"></div>
  128.  
  129. <!-- Contact Detail Section -->
  130. <?php if( $contact_setting['contact-callout-enable'] == 0) { ?>
  131. <div class="contact-detail-section" style="background: url('<?php echo $contact_setting['contact_callout_back']; ?>') repeat <?php echo $contact_setting['contact_attachment']; ?> 0 0 rgba(0, 0, 0, 0); background-size:cover;">
  132. <div class="overlay" style="background: none repeat scroll 0 0 <?php echo ($contact_setting['contact_overlay']!=true?'transparent':'rgba(0, 0, 0, 0.2)'); ?>;">
  133. <div class="container">
  134. <!-- Section Title -->
  135. <div class="row">
  136. <div class="col-md-12">
  137.  
  138. <div class="section-heading-title">
  139. <h1 class="text-color"><?php echo $contact_setting['contact_title']; ?></h1>
  140. <p class="text-color"><?php echo $contact_setting['contact_description']; ?></p>
  141. </div>
  142. </div>
  143. </div>
  144. <!-- /Section Title -->
  145.  
  146. <!-- Contact Area -->
  147. <div class="row">
  148. <div class="col-md-4">
  149. <div class="contact-detail-area">
  150.  
  151. <i class="fa <?php echo $contact_setting['contact_call_icon'];?>"></i>
  152. <h6><?php echo $contact_setting['contact_call_title']; ?></h6>
  153. <address><?php echo $contact_setting['contact_call_description'];?></address>
  154.  
  155. </div>
  156. </div>
  157. <div class="col-md-4">
  158. <div class="contact-detail-area">
  159.  
  160. <i class="fa <?php echo $contact_setting['contact_add_icon']; ?>"></i>
  161. <h6><?php echo $contact_setting['contact_add_title']; ?></h6>
  162. <address><?php echo $contact_setting['contact_add_description']; ?></address>
  163. </div>
  164. </div>
  165. <div class="col-md-4">
  166. <div class="contact-detail-area">
  167. <i class="fa <?php echo $contact_setting['contact_mail_icon']; ?>"></i>
  168. <h6><?php echo $contact_setting['contact_mail_title']; ?></h6>
  169. <address><?php echo $contact_setting['contact_mail_description']; ?></address>
  170. </div>
  171. </div>
  172. </div>
  173.  
  174. <!-- /Contact Area -->
  175. </div>
  176.  
  177. </div>
  178. </div>
  179. <?php } ?>
  180. <!-- /Contact Detail Section -->
  181.  
  182. <div class="clearfix"></div>
  183.  
  184. <!-- Horizontal Callout Section -->
  185.  
  186. <?php if( $contact_setting['check_contact_callout'] == 0) { ?>
  187. <div class="hrtl-callout-section">
  188. <div class="container">
  189.  
  190. <div class="row">
  191. <div class="col-md-<?php if($contact_setting['contact_callout_button'] == null){echo 12;} else{echo 9;}?>">
  192. <h2><?php echo $contact_setting['contact_callout_title']; ?></h2>
  193. <p><?php echo $contact_setting['contact_callout_description']; ?></p>
  194.  
  195. </div>
  196. <?php if($contact_setting['contact_callout_button'] != null): ?>
  197. <div class="col-md-3">
  198.  
  199. <div class="hrtl-btn-area">
  200. <a href="<?php echo $contact_setting['contact_callout_button_link']; ?>" <?php if( $contact_setting['contact_callout_link_target'] == 1) { echo "target='_blank'"; } ?> class="hrtl-btn"><?php echo $contact_setting['contact_callout_button']; ?></a>
  201. </div>
  202.  
  203. </div>
  204. <?php endif; ?>
  205. </div>
  206. </div>
  207. </div>
  208. <?php } ?>
  209. <?php get_template_part('index','home-callout'); ?>
  210. <!-- /Horizontal Callout Section -->
  211. <div class="clearfix"></div>
  212. <!-- Footer Section -->
  213. <?php get_footer(); ?>
  214. <!-- /Footer Section -->
Add Comment
Please, Sign In to add comment