Guest User

Untitled

a guest
Feb 4th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.91 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"
  115.                                src="https://yandex.com/map-widget/v1/?um=constructor%3Ac727333e70f9036624dfd99767064debc6927685843d280978f22717706c0e5f&amp;source=constructor">
  116.                        </iframe>
  117.                     </div>
  118.                 </div>
  119.                     <?php } ?>
  120.             <!--Google Map-->
  121.        
  122.            
  123.         </div>
  124.        
  125.     </div>
  126. </div>
  127. <!-- /Contact Section -->
  128.  
  129. <div class="clearfix"></div>
  130.  
  131. <!-- Contact Detail Section -->
  132. <?php if( $contact_setting['contact-callout-enable'] == 0) { ?>
  133. <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;">
  134.     <div class="overlay" style="background: none repeat scroll 0 0 <?php echo ($contact_setting['contact_overlay']!=true?'transparent':'rgba(0, 0, 0, 0.2)'); ?>;">
  135.         <div class="container">
  136.             <!-- Section Title -->     
  137.             <div class="row">
  138.                 <div class="col-md-12">
  139.                
  140.                     <div class="section-heading-title">
  141.                         <h1 class="text-color"><?php echo $contact_setting['contact_title']; ?></h1>
  142.                         <p class="text-color"><?php echo $contact_setting['contact_description']; ?></p>
  143.                     </div>
  144.                 </div>
  145.             </div>
  146.             <!-- /Section Title -->
  147.            
  148.             <!-- Contact Area -->
  149.             <div class="row">
  150.                 <div class="col-md-4">
  151.                     <div class="contact-detail-area">
  152.                
  153.                             <i class="fa <?php echo $contact_setting['contact_call_icon'];?>"></i>
  154.                             <h6><?php echo $contact_setting['contact_call_title'];  ?></h6>
  155.                             <address><?php echo $contact_setting['contact_call_description'];?></address>
  156.                    
  157.                     </div>
  158.                 </div>
  159.                 <div class="col-md-4">
  160.                     <div class="contact-detail-area">
  161.                    
  162.                             <i class="fa <?php echo $contact_setting['contact_add_icon']; ?>"></i>
  163.                             <h6><?php echo $contact_setting['contact_add_title'];  ?></h6>
  164.                             <address><?php echo $contact_setting['contact_add_description']; ?></address>
  165.                     </div>
  166.                 </div>
  167.                 <div class="col-md-4">
  168.                     <div class="contact-detail-area">
  169.                             <i class="fa <?php echo $contact_setting['contact_mail_icon']; ?>"></i>
  170.                             <h6><?php echo $contact_setting['contact_mail_title'];   ?></h6>
  171.                             <address><?php echo $contact_setting['contact_mail_description']; ?></address>
  172.                     </div>
  173.                 </div>
  174.             </div>
  175.            
  176.             <!-- /Contact Area -->
  177.         </div>
  178.            
  179.     </div> 
  180. </div>
  181. <?php } ?>
  182. <!-- /Contact Detail Section -->
  183.  
  184. <div class="clearfix"></div>
  185.  
  186. <!-- Horizontal Callout Section -->
  187.  
  188. <?php if( $contact_setting['check_contact_callout'] == 0) { ?>
  189. <div class="hrtl-callout-section">
  190.     <div class="container">
  191.        
  192.         <div class="row">
  193.             <div class="col-md-<?php if($contact_setting['contact_callout_button'] == null){echo 12;} else{echo 9;}?>">
  194.                     <h2><?php echo $contact_setting['contact_callout_title'];  ?></h2>
  195.                     <p><?php echo $contact_setting['contact_callout_description'];  ?></p>
  196.                
  197.             </div>
  198.             <?php if($contact_setting['contact_callout_button'] != null): ?>
  199.             <div class="col-md-3">
  200.                
  201.                 <div class="hrtl-btn-area">
  202.                 <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>
  203.                 </div>
  204.                
  205.             </div>
  206.             <?php endif; ?>
  207.         </div>
  208.     </div>
  209. </div>
  210. <?php } ?>
  211. <!-- /Horizontal Callout Section -->
  212. <div class="clearfix"></div>
  213. <!-- Footer Section -->
  214. <?php get_footer(); ?>
  215. <!-- /Footer Section -->
Add Comment
Please, Sign In to add comment