Advertisement
Guest User

Untitled

a guest
Aug 28th, 2014
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.56 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Contact
  4. */
  5. ?>
  6. <?php
  7. if(isset($_POST["u_name"]) && isset($_POST["u_email"]) && isset($_POST["u_message"])){
  8. header("HTTP/1.0 200 OK");
  9. $name = $_POST["u_name"];
  10. $email = $_POST["u_email"];
  11. $message = $_POST["u_message"];
  12. $tel = $_POST["u_tel"];
  13. if($name != '' && $email != '' & $message != ''){
  14.  
  15. $to = get_field("receiving_emails");
  16. $from = $email;
  17. $message = $message."
  18.  
  19. Phone Number : {$tel}
  20. ";
  21. $headers[] = "From: {$name} <{$email}>";
  22. $subject = get_bloginfo("name").__(" : Contact Form");
  23. wp_mail( $to, $subject, $message, $headers );
  24. echo $to;
  25. }
  26. die;
  27. }
  28. ?>
  29. <?php get_header(); ?>
  30. <div class="content">
  31. <div class="inner_content">
  32. <?php if(get_field("display_contact_form")): ?>
  33. <div class="widget_container col_620 widget_anim">
  34. <div class="contact widget">
  35. <h3 class="widget_title"><?php _e("Contact Form","um_lang"); ?></h3>
  36. <div class="space"></div>
  37. <?php if(get_field("contact_form_text")): ?>
  38. <p><?php the_field("contact_form_text"); ?></p>
  39. <?php endif; ?>
  40. <form action="<?php the_permalink(); ?>" method="post" class="contact_form">
  41. <div class="contact_form_info">
  42. <p class="widget_anim">
  43. <strong class="label"><span><?php _e("Name","um_lang"); ?></span></strong>
  44. <input type="text" name="name" id="name" /></input>
  45. </p>
  46. <p class="widget_anim">
  47. <strong class="label"><span><?php _e("Email","um_lang"); ?></span></strong>
  48. <input type="text" name="email" id="email" />
  49. </p>
  50. <p class="widget_anim">
  51. <strong class="label"><span><?php _e("Mob","um_lang"); ?></span></strong>
  52. <input type="text" id="mob" name="mob"/>
  53. </p>
  54. </div>
  55. <div class="message">
  56. <p>
  57. <textarea name="message" id="message" placeholder="your message goes here..."></textarea>
  58. </p>
  59. </div><br style="clear:both;">
  60. <?php if(get_field("contact_form_bottom_text")): ?>
  61. <p class="info_text"><?php the_field("contact_form_bottom_text"); ?></p>
  62. <?php endif; ?>
  63. <div class="form_buttons">
  64. <a class="reset" href="#"><?php _e("Reset","um_lang"); ?></a>
  65. <input type="submit" name="send" id="send" value="<?php _e("Send message","um_lang"); ?>">
  66. </div>
  67. </form>
  68. <div class="message_success" style="display:none">
  69. <p></p><p></p><p></p>
  70. <p><?php the_field("success_message"); ?></p>
  71. </div>
  72. <div style="clear:both"></div>
  73. </div>
  74. </div>
  75. <?php endif; ?>
  76.  
  77. <?php if(get_field("display_google_map")): ?>
  78. <?php
  79. $location = get_field("google_map");
  80. if($location || (get_field("google_map_latitude") && get_field("google_map_longitude")) ):
  81. ?>
  82. <div class="widget_container col_300 widget_anim">
  83. <div class="map widget">
  84. <div id="map"></div>
  85. <?php
  86. if($location || (get_field("google_map_latitude") && get_field("google_map_longitude")) ):
  87. if(!$location){
  88. $location["coordinates"] = get_field("google_map_latitude").",".get_field("google_map_longitude");
  89. }
  90. ?>
  91. <style>
  92. #map{
  93. width:300px;
  94. height:366px;
  95. }
  96. </style>
  97. <script>
  98.  
  99. /* Google Map */
  100.  
  101. var map;
  102.  
  103. function addMarker(location) {
  104. marker = new google.maps.Marker({
  105. position: location,
  106. map: map
  107. });
  108. }
  109.  
  110. function initialize() {
  111.  
  112. var stylez = [
  113. {
  114. featureType: "all",
  115. elementType: "all",
  116. stylers: [
  117. { saturation: -100 }
  118. ]
  119. }
  120. ];
  121.  
  122. var myLatlng = new google.maps.LatLng(<?php echo $location["coordinates"]; ?>);
  123. var mapOptions = {
  124. zoom: 8,
  125. center: myLatlng,
  126. mapTypeId: google.maps.MapTypeId.ROADMAP,
  127. mapTypeControl: false,
  128. mapTypeControlOptions: {
  129. mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'grey']
  130. },
  131. zoomControl: true,
  132. zoomControlOptions: {
  133. style: google.maps.ZoomControlStyle.SMALL
  134. }
  135. };
  136.  
  137. map = new google.maps.Map(document.getElementById('map'), mapOptions);
  138. var mapType = new google.maps.StyledMapType(stylez, { name: "Grayscale" });
  139. map.mapTypes.set('grey', mapType);
  140. map.setMapTypeId('grey');
  141.  
  142. var marker = new google.maps.Marker({
  143. position: myLatlng,
  144. map: map,
  145. title:"<?php echo $location["address"]; ?>"
  146. });
  147.  
  148. };
  149.  
  150. google.maps.event.addDomListener(window, 'load', initialize);
  151.  
  152. /* Google Map */
  153.  
  154. </script>
  155. <?php endif; ?>
  156. <?php if(get_field("display_google_map_gps_button")): ?>
  157. <a href="#" class="map_button" onclick="event.preventDefault();alert('Adress : <?php echo $location["address"]; ?>');"><?php _e("get gps cordinates","um_lang"); ?></a>
  158. <?php endif; ?>
  159. </div>
  160. </div>
  161. <?php endif; ?>
  162. <?php endif; ?>
  163.  
  164. <?php if(get_field("display_contact_info")): ?>
  165. <div class="widget_container col_300 widget_anim">
  166. <div class="contact_info widget">
  167. <h3 class="widget_title"><?php _e("Contact Info","um_lang"); ?></h3>
  168. <p><?php the_field("contact_info_test"); ?></p>
  169. <ul class="contact_info_list">
  170.  
  171. <?php if(get_field("address")): ?>
  172. <li class="widget_anim">
  173. <i class="contact_icon info_location fa fa-home"></i>
  174. <h3><?php _e("ADDRESS","um_lang"); ?></h3>
  175. <p><?php the_field("address"); ?></p>
  176. </li>
  177. <?php endif; ?>
  178.  
  179. <?php if(get_field("phone_numbers")): ?>
  180. <li class="widget_anim">
  181. <i class="contact_icon fa fa-phone"></i>
  182. <h3><?php _e("PHONE NUMBERS","um_lang"); ?></h3>
  183. <p><?php the_field("phone_numbers"); ?></p>
  184. </li>
  185. <?php endif; ?>
  186.  
  187. <?php if(get_field("email_addresses")): ?>
  188. <li class="widget_anim">
  189. <i class="contact_icon fa fa-envelope"></i>
  190. <h3><?php _e("EMAIL ADDRESS","um_lang"); ?></h3>
  191. <p><?php the_field("email_addresses"); ?></p>
  192. </li>
  193. <?php endif; ?>
  194.  
  195. </ul>
  196. </div>
  197. </div>
  198. <?php endif; ?>
  199. <br style="clear:both;">
  200. </div><!--Close Inner Content-->
  201. </div><!--Close Content-->
  202. <?php get_footer(); ?>
  203. </div><!--Close Wrapper-->
  204. </body>
  205. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement