Guest User

Untitled

a guest
Nov 19th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.22 KB | None | 0 0
  1. <?php
  2. /**
  3. /**
  4. Template Name: ContactUs
  5. */
  6. get_header(); ?>
  7. <?php $elitepress_lite_options=theme_data_setup();
  8. $current_options = wp_parse_args( get_option( 'elitepress_lite_options', array() ), $elitepress_lite_options );
  9. $mapsrc= $current_options['contact_google_map_url'];
  10. $mapsrc=$mapsrc.'&amp;output=embed'; ?>
  11.  
  12. <!-- Page Title Section -->
  13. <?php get_template_part('index','banner'); ?>
  14. <!-- /Page Title Section -->
  15. <!-- Contact Info Section -->
  16. <div class="contact-section">
  17. <div class="container">
  18. <div class="row">
  19. <!--Contact Form-->
  20. <div class="col-md-8">
  21. <div id="mailsentbox" style="display:none">
  22. <div class="alert alert-success" >
  23. <strong><?php _e('Thank you','elitepress');?></strong> <?php _e('Your information has been sent.','elitepress');?>
  24. </div>
  25. </div>
  26. <div class="comment-form-section" id="myformdata">
  27. <?php the_post(); echo the_content(); ?>
  28. </div>
  29. </div>
  30. <!--Conatct Form-->
  31.  
  32. <?php
  33. if(isset($_POST['contact_submit']))
  34. { $flag=1;
  35. if(empty($_POST['user_name']))
  36. {
  37. $flag=0;
  38. echo "<script>jQuery('#contact_user_name_error').show();</script>";
  39. } else
  40. if($_POST['user_email']=='')
  41. {
  42. $flag=0;
  43. echo "<script>jQuery('#contact_user_email_error').show();</script>";
  44. } else
  45. if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i",$_POST['user_email']))
  46. {
  47. $flag=0;
  48. echo "<script>jQuery('#contact_user_email_error').show();</script>";
  49. } else
  50. if($_POST['user_massage']=='')
  51. {
  52. $flag=0;
  53. echo "<script>jQuery('#contact_user_massage_error').show();</script>";
  54. }else
  55. if(empty($_POST) || !wp_verify_nonce($_POST['elitepress_name_nonce_field'],'elitepress_name_nonce_check') )
  56. {
  57. echo "<script>jQuery('#contact_nonce_error').show();</script>";
  58. exit;
  59. }
  60. else
  61. { if($flag==1)
  62. {
  63. $to = get_option('admin_email');
  64. $subject = trim($_POST['user_name']) . get_option("blogname");
  65. $massage = stripslashes(trim($_POST['user_massage']))."Message sent from:: ".trim($_POST['user_email']);
  66. $headers = "From: ".trim($_POST['user_name'])." <".trim($_POST['user_email']).">\r\nReply-To:".trim($_POST['user_email']);
  67. $maildata =wp_mail($to, $subject, $massage, $headers);
  68. if($maildata){
  69. echo "<script>jQuery('#myformdata').hide();</script>";
  70. echo "<script>jQuery('#mailsentbox').show();</script>";
  71. }
  72. }
  73. }
  74. }
  75. ?>
  76. <!--/Conatct Form-->
  77.  
  78. <!--Contact Detail-->
  79. <div class="col-md-4">
  80. <?php echo $current_options['contact_text'];?>
  81. </div>
  82. <!--/Conatct Detail-->
  83. </div>
  84.  
  85. <!--Google Map-->
  86. <div class="row">
  87. <div class="col-md-12">
  88. <?php if($current_options['contact_google_map_enabled'] == true && $current_options['contact_google_map_url'] != null ){ ?>
  89. <div class="google-map">
  90. <iframe width="100%" scrolling="no" height="400" frameborder="0" marginheight="0" marginwidth="0" src="<?php echo esc_url($mapsrc); ?>"></iframe>
  91. </div>
  92. </div>
  93. <?php } ?>
  94. </div>
  95. <!--Google Map-->
  96. </div>
  97. </div>
  98. <!-- Footer Section -->
  99. <?php get_footer(); ?>
  100. <!-- /Footer Section -->
Add Comment
Please, Sign In to add comment