Advertisement
Guest User

Untitled

a guest
Jan 5th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.61 KB | None | 0 0
  1. <?php
  2. /**
  3. /* Template Name: Contact Page
  4. * The template for displaying the contact us page.
  5. *
  6. * Learn more: http://codex.wordpress.org/Template_Hierarchy
  7. *
  8. * @package WordPress
  9. * @subpackage Transfers
  10. * @since Transfers 1.0
  11. */
  12.  
  13. get_header();
  14. get_sidebar('under-header');
  15.  
  16. global $post, $transfers_theme_globals;
  17.  
  18. $contact_address_latitude = $transfers_theme_globals->get_contact_address_latitude();
  19. $contact_address_longitude = $transfers_theme_globals->get_contact_address_longitude();
  20. $contact_company_name = $transfers_theme_globals->get_contact_company_name();
  21. $contact_address = $transfers_theme_globals->get_contact_address();
  22.  
  23. $enc_key = $transfers_theme_globals->get_enc_key();
  24. $add_captcha_to_forms = $transfers_theme_globals->add_captcha_to_forms();
  25.  
  26. $page_id = $post->ID;
  27. $page_custom_fields = get_post_custom( $page_id);
  28.  
  29. $page_sidebar_positioning = null;
  30. if (isset($page_custom_fields['page_sidebar_positioning'])) {
  31. $page_sidebar_positioning = $page_custom_fields['page_sidebar_positioning'][0];
  32. $page_sidebar_positioning = empty($page_sidebar_positioning) ? '' : $page_sidebar_positioning;
  33. }
  34.  
  35. $section_class = 'full-width';
  36. if ($page_sidebar_positioning == 'both')
  37. $section_class = 'one-half';
  38. else if ($page_sidebar_positioning == 'left' || $page_sidebar_positioning == 'right')
  39. $section_class = 'three-fourth';
  40.  
  41. $c_val_1 = mt_rand(1, 20);
  42. $c_val_2 = mt_rand(1, 20);
  43.  
  44. $c_val_1_str = transfers_encrypt($c_val_1, $enc_key);
  45. $c_val_2_str = transfers_encrypt($c_val_2, $enc_key);
  46. ?>
  47. <script>
  48. window.contactAddressLatitude = <?php echo json_encode($contact_address_latitude); ?>;
  49. window.contactAddressLongitude = <?php echo json_encode($contact_address_longitude); ?>;
  50. window.contactCompanyName = <?php echo json_encode($contact_company_name); ?>;
  51. window.contactAddress = <?php echo json_encode($contact_address); ?>;
  52. </script>
  53. <?php if ( have_posts() ) : the_post(); ?>
  54. <!-- Page info -->
  55. <header class="site-title color">
  56. <div class="wrap">
  57. <div class="container">
  58. <h1><?php the_title(); ?></h1>
  59. <?php
  60. $allowed_tags = Transfers_Theme_Utils::get_allowed_breadcrumbs_tags_array();
  61. $breadcrumbs_html = $transfers_theme_globals->get_breadcrumbs();
  62. echo wp_kses($breadcrumbs_html, $allowed_tags);
  63. ?>
  64. </div>
  65. </div>
  66. </header>
  67.  
  68. <?php if (!empty($contact_address_latitude) && !empty($contact_address_longitude)) {
  69. $google_maps_key = $transfers_theme_globals->get_google_maps_key();
  70. $allowed_tags = transfers_get_allowed_content_tags_array();
  71. if (!empty($google_maps_key)) {
  72. ?>
  73. <!--- Google map -->
  74. <div id="map_canvas" class="gmap"></div>
  75. <!--- //Google map -->
  76. <?php
  77. } else {?>
  78. <div class="wrap">
  79. <div class="row">
  80. <div class="<?php echo esc_attr($section_class); ?>">
  81. <p><?php echo wp_kses(__('Before using google maps you must go to <a href="https://developers.google.com/maps/documentation/javascript/get-api-key">Google maps api console</a> and get an api key. After you do, please proceed to Appearance -> Theme options -> Configuration settings and enter your key in the field labeled "Google maps api key"', 'transfers'), $allowed_tags); ?></p>
  82. </div>
  83. </div>
  84. </div>
  85. <?php }
  86. }
  87. ?>
  88. <div class="wrap">
  89. <div class="row">
  90. <!--- Content -->
  91. <?php
  92. if ($page_sidebar_positioning == 'both' || $page_sidebar_positioning == 'left')
  93. get_sidebar('left');
  94. ?>
  95. <div class="<?php echo esc_attr($section_class); ?>">
  96. <div class="textongrey content">
  97. <?php if ( has_post_thumbnail() ) { ?>
  98. <figure class="entry-featured">
  99. <?php the_post_thumbnail(TRANSFERS_CONTENT_IMAGE_SIZE, array('title' => '')); ?>
  100. <div class="overlay">
  101. <a href="<?php esc_url(get_the_permalink()) ?>" class="expand">+</a>
  102. </div>
  103. </figure>
  104. <?php } ?>
  105. <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'transfers' ) ); ?>
  106. <?php wp_link_pages('before=<div class="pagination">&after=</div>'); ?>
  107. </div>
  108. <!-- Form -->
  109. <div class="thankyou box" style="display:none">
  110. <a id="thankyou"></a>
  111. <h6><?php esc_html_e('Email sent successfully.', 'transfers'); ?></h6>
  112. <p><?php esc_html_e('Thank you for contacting us. We will get back to you as soon as we can.', 'transfers'); ?></p>
  113. </div>
  114. <div class="error" style="display:none">
  115. <p><?php esc_html_e('Errors were encountered when attempting to submit the contact form. Please correct your errors and submit again.', 'transfers'); ?></p>
  116. </div>
  117. <form method="post" action="<?php echo esc_url(transfers_get_current_page_url()); ?>" name="form-contact" id="form-contact">
  118. <div class="f-row">
  119. <div class="one-half">
  120. <label for="contact_name"><?php esc_html_e('First and Last Name', 'transfers'); ?></label>
  121. <input type="text" id="contact_name" name="contact_name" />
  122. </div>
  123. <div class="one-half">
  124. <label for="contact_phone"><?php esc_html_e('Phone Number', 'transfers'); ?></label>
  125. <input type="number" maxlength="12" id="contact_phone" name="contact_phone" />
  126. </div>
  127. <div class="f-row">
  128. <label for="contact_email"><?php esc_html_e('Email address', 'transfers'); ?></label>
  129. <input type="email" id="contact_email" name="contact_email" />
  130. </div>
  131. </div>
  132. <div class="f-row">
  133. <div class="full-width">
  134. <label for="contact_message"><?php esc_html_e('Message', 'transfers'); ?></label>
  135. <textarea id="contact_message" name="contact_message"></textarea>
  136. </div>
  137. </div>
  138. <?php if ($add_captcha_to_forms) { ?>
  139. <div class="f-row captcha">
  140. <div class="full-width">
  141. <label><?php echo sprintf(__('How much is %d + %d', 'transfers'), $c_val_1, $c_val_2) ?>?</label>
  142. <input type="text" id="c_val_s_con" name="c_val_s" class="required" />
  143. <input type="hidden" name="c_val_1" id="c_val_1_con" value="<?php echo esc_attr($c_val_1_str); ?>" />
  144. <input type="hidden" name="c_val_2" id="c_val_2_con" value="<?php echo esc_attr($c_val_2_str); ?>" />
  145. </div>
  146. </div>
  147. <?php } ?>
  148. <?php wp_nonce_field('contact_form','contact_form_nonce'); ?>
  149. <div class="f-row">
  150. <input type="submit" value="<?php esc_attr_e('Submit', 'transfers'); ?>" id="submit-contact" name="submit-contact" class="btn color medium right" />
  151. </div>
  152. </form>
  153. </div>
  154. <!-- //Form -->
  155. <!--- // Content -->
  156. <?php
  157. if ($page_sidebar_positioning == 'both' || $page_sidebar_positioning == 'right')
  158. get_sidebar('right');
  159. ?>
  160. </div>
  161. </div>
  162. <?php endif; ?>
  163. <?php
  164. get_footer();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement