webriti

Health Centre contact template past bin

Feb 22nd, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.94 KB | None | 0 0
  1. <?php
  2. // Template Name: Contact-Us
  3. /**
  4. * @Theme Name : Health-Center
  5. * @file : contact-page.php
  6. * @package : Health-Center
  7. * @author : Hari Maliya
  8. * @license : license.txt
  9. * @filesource : wp-content/themes/health-center/contact-page.php
  10. */
  11. ?>
  12. <?php get_header(); ?>
  13. <!-- HC Contact Form Section -->
  14. <?php $current_options=get_option('hc_pro_options');
  15. $mapsrc= $current_options['hc_contact_google_map_url'];
  16. $mapsrc=$mapsrc.'&amp;output=embed';
  17. ?>
  18. <div class="container">
  19. <div class="row">
  20. <div class="hc_page_header_area">
  21. <h1><?php the_title(); ?></h1>
  22. </div>
  23. </div>
  24. </div>
  25.  
  26. <!-- HC Google Map Section -->
  27. <?php if($current_options['contact_google_map_enabled'] == true){?>
  28. <div class="container">
  29. <div class="row hc_contactv1_section">
  30. <div class="col-md-12 hc_google_map">
  31. <iframe width="100%" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="<?php echo $mapsrc; ?>"></iframe>
  32. </div>
  33. </div>
  34. </div>
  35. <?php } ?>
  36. <!-- /HC Google Map Section -->
  37. <div class="container">
  38. <div class="row">
  39. <div class="col-md-8 hc_contactv1_area">
  40. <div id="myformdata">
  41. <?php if($current_options['hc_send_usmessage']!='') { ?>
  42. <h2><?php echo $current_options['hc_send_usmessage']; ?></h2>
  43. <?php } ?>
  44. <form role="form" method="post" action="">
  45. <?php wp_nonce_field('hc_name_nonce_check','hc_name_nonce_field'); ?>
  46. <div class="hc_form_group">
  47. <label for="user_name"><?php _e('Name','health'); ?><small>*</small></label>
  48. <input type="text" id="user_name" name="user_name" class="hc_con_input_control">
  49. <span style="display:none; color:red" id="contact_user_name_error"><?php _e('Please Enter Your Name','health'); ?> </span>
  50. </div>
  51. <div class="hc_form_group">
  52. <label for="user_email"><?php _e('Email','health'); ?><small>*</small></label>
  53. <input type="email" id="user_email" name="user_email" class="hc_con_input_control">
  54. <span style="display:none; color:red" id="contact_email_error"><?php _e('Please Enter valid email','health'); ?> </span>
  55. </div>
  56. <div class="hc_form_group">
  57. <label for="user_website"><?php _e('Subject','health'); ?><small>*</small></label>
  58. <input type="text" id="user_website" name= "user_website" class="hc_con_input_control">
  59. </div>
  60. <div class="hc_form_group">
  61. <label for="Comment"><?php _e('Comment','health') ?></label>
  62. <textarea class="hc_con_textarea_control" name="user_comment" id="user_comment" rows="5"></textarea>
  63. <span style="display:none; color:red" id="contact_massage_error"><?php _e('Please Enter your contact message','health'); ?></span>
  64. </div>
  65. <button class="hc_btn" type="submit" name="contact_submit" id="contact_submit"><?php _e('Send Message','health'); ?></button>
  66. <span style="display:none; color:red" id="contact_nonce_error"><?php _e('Sorry, your nonce did not verify','health');?></span> </form>
  67. </div>
  68. <div id="mailsentbox" style="display:none">
  69. <div class="alert alert-success" >
  70. <strong><?php _e('Thank you!','health');?></strong> <?php _e('You successfully sent contact information...','health');?>
  71. </div>
  72. </div>
  73. </div>
  74. <?php if($current_options['hc_get_in_touch_enabled']==true) { ?>
  75. <div class="col-md-4 hc_contactv1_sidebar">
  76.  
  77. <div class="hc_contactv1_address">
  78. <?php if($current_options['hc_get_in_touch']!='') { ?>
  79. <h3><?php echo $current_options['hc_get_in_touch']; ?></h3>
  80. <?php } ?>
  81. <address>
  82. <?php if($current_options['hc_contact_address']!='')
  83. { echo $current_options['hc_contact_address']; } ?><br>
  84. <?php if($current_options['hc_contact_address_two']!='')
  85. { echo $current_options['hc_contact_address_two']; } ?><br>
  86. <?php if($current_options['hc_contact_phone_number']!='') { ?>
  87. <?php _e('Phone:','health'); ?>&nbsp;&nbsp;<?php echo $current_options['hc_contact_phone_number']; ?><br>
  88. <?php } ?>
  89. <?php if($current_options['hc_contact_fax_number']!='') { ?>
  90. <?php _e('Fax:','health'); ?>&nbsp;&nbsp;<?php echo $current_options['hc_contact_fax_number']; ?><br>
  91. <?php } ?>
  92. <?php if($current_options['hc_contact_email']!='') { ?>
  93. <?php _e('Email:','health');?> &nbsp;&nbsp;<a href="mailto:#"><?php echo $current_options['hc_contact_email']; ?></a><br>
  94. <?php } ?>
  95. </address>
  96. </div>
  97. <?php if($current_options['social_media_in_contact_page_enabled'] ==true) { ?>
  98. <div class="hc_contactv1_address">
  99. <h3><?php _e('Social Network','health'); ?></h3>
  100. <div class="hc_contactv1_social">
  101. <?php if($current_options['social_media_facebook_link']!='') { ?>
  102. <a href="<?php echo $current_options['social_media_facebook_link']; ?>" title="Facebook" class="facebook">&nbsp;</a>
  103. <?php }
  104. if($current_options['social_media_twitter_link']!='') { ?>
  105. <a href="<?php echo $current_options['social_media_twitter_link']; ?>" title="Twitter" class="twitter">&nbsp;</a>
  106. <?php }
  107. if($current_options['social_media_linkedin_link']!='') { ?>
  108. <a href="<?php echo $current_options['social_media_linkedin_link']; ?>" title="Linked-id" class="linked_in">&nbsp;</a>
  109. <?php }
  110. if($current_options['social_media_google_plus']!='') { ?>
  111. <a href="<?php echo $current_options['social_media_google_plus']; ?>" title="Google+" class="google_plus">&nbsp;</a>
  112. <?php } ?>
  113. </div>
  114. </div>
  115. <?php } ?>
  116. </div>
  117. <?php } ?>
  118. </div>
  119. <?php
  120. if(isset($_POST['contact_submit']))
  121. { $flag=1;
  122. if(empty($_POST['user_name']))
  123. {
  124. $flag=0;
  125. echo "<script>jQuery('#contact_user_name_error').show();</script>";
  126. }else
  127. if($_POST['user_email']=='')
  128. {
  129. $flag=0;
  130. echo "<script>jQuery('#contact_email_error').show();</script>";
  131. }else
  132. if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i",$_POST['user_email']))
  133. {
  134. $flag=0;
  135. echo "<script>jQuery('#contact_email_error').show();</script>";
  136. }else
  137. if($_POST['user_comment']=='')
  138. {
  139. $flag=0;
  140. echo "<script>jQuery('#contact_massage_error').show();</script>";
  141. }else
  142. if(empty($_POST) || !wp_verify_nonce($_POST['hc_name_nonce_field'],'hc_name_nonce_check') )
  143. {
  144. echo "<script>jQuery('#contact_nonce_error').show();</script>";
  145. exit;
  146. }
  147. else
  148. { if($flag==1)
  149. {
  150. $to = get_option('admin_email');
  151. $subject = "MAIL FROM YOUR WORDPRESS BLOG SITE";
  152. $massage = stripslashes(trim($_POST['user_comment']))."Message sent from:: ".trim($_POST['user_email']);
  153. $headers = "From: ".trim($_POST['user_name'])." <".trim($_POST['user_email']).">\r\nReply-To:".trim($_POST['user_email']);
  154. $maildata =wp_mail($to, $subject, $massage, $headers);
  155.  
  156. echo "<script>jQuery('#myformdata').hide();</script>";
  157. echo "<script>jQuery('#mailsentbox').show();</script>";
  158.  
  159. }
  160. }
  161. }
  162. ?>
  163.  
  164. </div>
  165. <!-- /HC Contact Form Section -->
  166. <?php get_footer(); ?>
Add Comment
Please, Sign In to add comment