Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Template Name: Contact
- */
- ?>
- <?php
- if(isset($_POST["u_name"]) && isset($_POST["u_email"]) && isset($_POST["u_message"])){
- header("HTTP/1.0 200 OK");
- $name = $_POST["u_name"];
- $email = $_POST["u_email"];
- $message = $_POST["u_message"];
- $tel = $_POST["u_tel"];
- if($name != '' && $email != '' & $message != ''){
- $to = get_field("receiving_emails");
- $from = $email;
- $message = $message."
- Phone Number : {$tel}
- ";
- $headers[] = "From: {$name} <{$email}>";
- $subject = get_bloginfo("name").__(" : Contact Form");
- wp_mail( $to, $subject, $message, $headers );
- echo $to;
- }
- die;
- }
- ?>
- <?php get_header(); ?>
- <div class="content">
- <div class="inner_content">
- <?php if(get_field("display_contact_form")): ?>
- <div class="widget_container col_620 widget_anim">
- <div class="contact widget">
- <h3 class="widget_title"><?php _e("Contact Form","um_lang"); ?></h3>
- <div class="space"></div>
- <?php if(get_field("contact_form_text")): ?>
- <p><?php the_field("contact_form_text"); ?></p>
- <?php endif; ?>
- <form action="<?php the_permalink(); ?>" method="post" class="contact_form">
- <div class="contact_form_info">
- <p class="widget_anim">
- <strong class="label"><span><?php _e("Name","um_lang"); ?></span></strong>
- <input type="text" name="name" id="name" /></input>
- </p>
- <p class="widget_anim">
- <strong class="label"><span><?php _e("Email","um_lang"); ?></span></strong>
- <input type="text" name="email" id="email" />
- </p>
- <p class="widget_anim">
- <strong class="label"><span><?php _e("Mob","um_lang"); ?></span></strong>
- <input type="text" id="mob" name="mob"/>
- </p>
- </div>
- <div class="message">
- <p>
- <textarea name="message" id="message" placeholder="your message goes here..."></textarea>
- </p>
- </div><br style="clear:both;">
- <?php if(get_field("contact_form_bottom_text")): ?>
- <p class="info_text"><?php the_field("contact_form_bottom_text"); ?></p>
- <?php endif; ?>
- <div class="form_buttons">
- <a class="reset" href="#"><?php _e("Reset","um_lang"); ?></a>
- <input type="submit" name="send" id="send" value="<?php _e("Send message","um_lang"); ?>">
- </div>
- </form>
- <div class="message_success" style="display:none">
- <p></p><p></p><p></p>
- <p><?php the_field("success_message"); ?></p>
- </div>
- <div style="clear:both"></div>
- </div>
- </div>
- <?php endif; ?>
- <?php if(get_field("display_google_map")): ?>
- <?php
- $location = get_field("google_map");
- if($location || (get_field("google_map_latitude") && get_field("google_map_longitude")) ):
- ?>
- <div class="widget_container col_300 widget_anim">
- <div class="map widget">
- <div id="map"></div>
- <?php
- if($location || (get_field("google_map_latitude") && get_field("google_map_longitude")) ):
- if(!$location){
- $location["coordinates"] = get_field("google_map_latitude").",".get_field("google_map_longitude");
- }
- ?>
- <style>
- #map{
- width:300px;
- height:366px;
- }
- </style>
- <script>
- /* Google Map */
- var map;
- function addMarker(location) {
- marker = new google.maps.Marker({
- position: location,
- map: map
- });
- }
- function initialize() {
- var stylez = [
- {
- featureType: "all",
- elementType: "all",
- stylers: [
- { saturation: -100 }
- ]
- }
- ];
- var myLatlng = new google.maps.LatLng(<?php echo $location["coordinates"]; ?>);
- var mapOptions = {
- zoom: 8,
- center: myLatlng,
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- mapTypeControl: false,
- mapTypeControlOptions: {
- mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'grey']
- },
- zoomControl: true,
- zoomControlOptions: {
- style: google.maps.ZoomControlStyle.SMALL
- }
- };
- map = new google.maps.Map(document.getElementById('map'), mapOptions);
- var mapType = new google.maps.StyledMapType(stylez, { name: "Grayscale" });
- map.mapTypes.set('grey', mapType);
- map.setMapTypeId('grey');
- var marker = new google.maps.Marker({
- position: myLatlng,
- map: map,
- title:"<?php echo $location["address"]; ?>"
- });
- };
- google.maps.event.addDomListener(window, 'load', initialize);
- /* Google Map */
- </script>
- <?php endif; ?>
- <?php if(get_field("display_google_map_gps_button")): ?>
- <a href="#" class="map_button" onclick="event.preventDefault();alert('Adress : <?php echo $location["address"]; ?>');"><?php _e("get gps cordinates","um_lang"); ?></a>
- <?php endif; ?>
- </div>
- </div>
- <?php endif; ?>
- <?php endif; ?>
- <?php if(get_field("display_contact_info")): ?>
- <div class="widget_container col_300 widget_anim">
- <div class="contact_info widget">
- <h3 class="widget_title"><?php _e("Contact Info","um_lang"); ?></h3>
- <p><?php the_field("contact_info_test"); ?></p>
- <ul class="contact_info_list">
- <?php if(get_field("address")): ?>
- <li class="widget_anim">
- <i class="contact_icon info_location fa fa-home"></i>
- <h3><?php _e("ADDRESS","um_lang"); ?></h3>
- <p><?php the_field("address"); ?></p>
- </li>
- <?php endif; ?>
- <?php if(get_field("phone_numbers")): ?>
- <li class="widget_anim">
- <i class="contact_icon fa fa-phone"></i>
- <h3><?php _e("PHONE NUMBERS","um_lang"); ?></h3>
- <p><?php the_field("phone_numbers"); ?></p>
- </li>
- <?php endif; ?>
- <?php if(get_field("email_addresses")): ?>
- <li class="widget_anim">
- <i class="contact_icon fa fa-envelope"></i>
- <h3><?php _e("EMAIL ADDRESS","um_lang"); ?></h3>
- <p><?php the_field("email_addresses"); ?></p>
- </li>
- <?php endif; ?>
- </ul>
- </div>
- </div>
- <?php endif; ?>
- <br style="clear:both;">
- </div><!--Close Inner Content-->
- </div><!--Close Content-->
- <?php get_footer(); ?>
- </div><!--Close Wrapper-->
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement