Advertisement
Guest User

Untitled

a guest
Feb 12th, 2017
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.53 KB | None | 0 0
  1. <div id="et_main_map"></div>
  2.  
  3.  
  4.  
  5. <script type="text/javascript">
  6. (function($){
  7. var $et_main_map = $( '#et_main_map' );
  8.  
  9. et_active_marker = null;
  10.  
  11. $et_main_map.gmap3({
  12. map:{
  13. options:{
  14. <?php
  15. while ( have_posts() ) : the_post();
  16. $et_location_lat = get_post_meta( get_the_ID(), '_et_listing_lat', true );
  17. $et_location_lng = get_post_meta( get_the_ID(), '_et_listing_lng', true );
  18.  
  19. if ( '' != $et_location_lat && '' != $et_location_lng )
  20. printf( 'center: [%s, %s],', $et_location_lat, $et_location_lng );
  21.  
  22. break;
  23. endwhile;
  24. rewind_posts();
  25. ?>
  26. zoom:<?php
  27. if ( is_home() || is_front_page() )
  28. echo esc_js( et_get_option( 'explorable_homepage_zoom_level', 3 ) );
  29. else
  30. echo esc_js( et_get_option( 'explorable_default_zoom_level', 5 ) ); ?>,
  31. mapTypeId: google.maps.MapTypeId.<?php echo esc_js( strtoupper( et_get_option( 'explorable_map_type', 'Roadmap' ) ) ); ?>,
  32. mapTypeControl: true,
  33. mapTypeControlOptions: {
  34. position : google.maps.ControlPosition.LEFT_CENTER,
  35.  
  36. style : google.maps.MapTypeControlStyle.DROPDOWN_MENU
  37. },
  38. streetViewControlOptions: {
  39. position: google.maps.ControlPosition.LEFT_CENTER
  40. },
  41. navigationControl: false,
  42. scrollwheel: true,
  43. streetViewControl: true,
  44. <?php if ( et_is_mobile_browser() ) { ?>
  45. draggable : true,
  46. <?php } ?>
  47. zoomControl: true
  48. }
  49. }
  50. });
  51.  
  52. function et_add_marker( marker_order, marker_lat, marker_lng, marker_description ){
  53. var marker_id = 'et_marker_' + marker_order;
  54.  
  55. $et_main_map.gmap3({
  56. marker : {
  57. id : marker_id,
  58. latLng : [marker_lat, marker_lng],
  59. options: {
  60.  
  61.  
  62. icon : "<?php echo get_template_directory_uri(); ?>/images/red-marker.png"
  63.  
  64. },
  65. events : {
  66. click: function( marker ){
  67. if ( et_active_marker ){
  68. et_active_marker.setAnimation( null );
  69. et_active_marker.setIcon( '<?php echo get_template_directory_uri(); ?>/images/red-marker.png' );
  70. }
  71. et_active_marker = (marker);
  72.  
  73. //marker.setAnimation( google.maps.Animation.BOUNCE); //this prevents the annoying bounce on loading the site
  74. marker.setIcon( '<?php echo get_template_directory_uri(); ?>/images/blue-marker.png' );
  75. //$(this).gmap3("get").panTo( marker.position); //this prevents the centering of the map on the latest point
  76. //printf( 'center: [%s, %s],', $et_location_lat, $et_location_lng); ///might be the starting point, but keeps resetting
  77. $.fn.et_simple_slider.external_move_to( marker_order );
  78. },
  79. mouseover: function( marker ){
  80. $( '#' + marker_id ).css( { 'display' : 'block', 'opacity' : 0 } ).stop(true,true).animate( { bottom : '15px', opacity : 1 }, 500 );
  81. },
  82. mouseout: function( marker ){
  83. $( '#' + marker_id ).stop(true,true).animate( { bottom : '50px', opacity : 0 }, 500, function() {
  84. $(this).css( { 'display' : 'none' } );
  85. } );
  86. }
  87. }
  88. },
  89. overlay : {
  90. latLng : [marker_lat, marker_lng],
  91. options : {
  92. content : marker_description,
  93. offset : {
  94. y:-42,
  95. x:-122
  96. }
  97. }
  98. }
  99. });
  100. }
  101.  
  102. <?php
  103. $i = 0;
  104. while ( have_posts() ) : the_post();
  105. $et_location_lat = get_post_meta( get_the_ID(), '_et_listing_lat', true );
  106. $et_location_lng = get_post_meta( get_the_ID(), '_et_listing_lng', true );
  107.  
  108. $et_location_rating = '<div class="location-rating"></div>';
  109. if ( ( $et_rating = et_get_rating() ) && 0 != $et_rating )
  110. $et_location_rating = '<div class="location-rating"><span class="et-rating"><span style="' . sprintf( 'width: %dpx;', esc_attr( $et_rating * 17 ) ) . '"></span></span></div>';
  111.  
  112. if ( '' != $et_location_lat && '' != $et_location_lng ) {
  113. ?>
  114. et_add_marker( <?php printf( '%1$d, %2$s, %3$s, \'<div id="et_marker_%1$d" class="et_marker_info"><div class="location-description"> <div class="location-title"><h3><a href="%6$s">%4$s</a></h3><div class="listing-info"><p>%5$s</p></div> </div> ' . $et_location_rating . ' </div> <!-- .location-description --> </div> <!-- .et_marker_info -->\'',
  115. $i,
  116. esc_html( $et_location_lat ),
  117. esc_html( $et_location_lng ),
  118. get_the_title(),
  119. wp_strip_all_tags( addslashes( get_the_term_list( get_the_ID(), 'listing_type', '', ', ' ) ) ),
  120. get_the_permalink()
  121. ); ?> );
  122. <?php
  123. }
  124.  
  125. $i++;
  126. endwhile;
  127.  
  128. rewind_posts();
  129. ?>
  130. })(jQuery)
  131. </script>
  132.  
  133. <div id="et-slider-wrapper" class="et-map-post">
  134. <div id="et-map-slides">
  135.  
  136. <?php
  137. $i = 1;
  138. while ( have_posts() ) : the_post();
  139. $thumb = '';
  140. $width = (int) apply_filters( 'et_map_image_width', 480 );
  141. $height = (int) apply_filters( 'et_map_image_height', 240 );
  142. $classtext = '';
  143. $titletext = get_the_title();
  144. $thumbnail = get_thumbnail( $width, $height, $classtext, $titletext, $titletext, false, 'MapIndex' );
  145. $thumb = $thumbnail["thumb"];
  146. ?>
  147. <div class="et-map-slide<?php if ( 1 == $i ) echo esc_attr( ' et-active-map-slide' ); ?>">
  148. <?php if ( ''!= $thumb ) { ?>
  149. <div class="thumbnail">
  150. <?php print_thumbnail( $thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext ); ?>
  151. <div class="et-description">
  152. <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
  153. <?php if ( ( $et_description = get_post_meta( get_the_ID(), '_et_listing_description', true ) ) && '' != $et_description ) : ?>
  154. <p><?php echo esc_html( $et_description ); ?></p>
  155. <?php endif; ?>
  156. <?php if ( ( $et_rating = et_get_rating() ) && 0 != $et_rating ) : ?>
  157. <span class="et-rating"><span style="<?php printf( 'width: %dpx;', esc_attr( $et_rating * 21 ) ); ?>"></span></span>
  158. <?php endif; ?>
  159. </div>
  160.  
  161. <?php
  162.  
  163. ?>
  164. </div>
  165. <?php } ?>
  166. <?php if ( ( $et_location_address = get_post_meta( get_the_ID(), '_et_listing_custom_address', true ) ) && '' != $et_location_address ) : ?>
  167. <div class="et-map-postmeta"><?php echo esc_html( $et_location_address ); ?></div>
  168. <?php endif; ?>
  169.  
  170. <div class="et-place-content">
  171. <div class="et-place-text-wrapper">
  172. <div class="et-place-main-text">
  173. <div class="scrollbar"><div class="track"><div class="thumb"><div class="end"></div></div></div></div>
  174. <div class="viewport">
  175. <div class="overview">
  176. <?php
  177. echo custom_field_excerpt();
  178. if ( has_excerpt() )
  179. the_excerpt();
  180. else
  181. the_excerpt();
  182. //the_content( '' );
  183. ?>
  184. </div>
  185. </div>
  186. </div> <!-- .et-place-main-text -->
  187. </div> <!-- .et-place-text-wrapper -->
  188. <a class="more" href="<?php the_permalink(); ?>"><?php esc_html_e( 'More Information', 'Explorable' ); ?><span>&raquo;</span></a>
  189. </div> <!-- .et-place-content -->
  190. </div> <!-- .et-map-slide -->
  191. <?php
  192. $i++;
  193. endwhile;
  194.  
  195. rewind_posts();
  196. ?>
  197. </div> <!-- #et-map-slides -->
  198. </div> <!-- .et-map-post -->
  199.  
  200.  
  201. <?php
  202. $listing_types_args = array( 'hide_empty' => 1 );
  203. $listing_locations_args = array( 'hide_empty' => 1 );
  204. $listing_statuses_args = array( 'hide_empty' => 1 );
  205. $listing_types = get_terms( 'listing_type', apply_filters( 'listing_types_args', $listing_types_args ) );
  206. $listing_locations = get_terms( 'listing_location', apply_filters( 'listing_locations_args', $listing_locations_args ) );
  207. $listing_statuses = get_terms( 'listing_status', apply_filters( 'listing_statuses_args', $listing_statuses_args ) );
  208. ?>
  209. <div id="filter-bar">
  210. <div class="container">
  211. <form method="get" id="et-filter-map" action="<?php echo esc_url( home_url( '/' ) ); ?>">
  212.  
  213.  
  214.  
  215.  
  216. <button id="et-filter"><?php esc_html_e( 'Filter', 'Explorable' ); ?></button>
  217. <input type="hidden" value="hi" name="st" />
  218. <input type="hidden" value="listing" name="post_type" />
  219.  
  220.  
  221.  
  222.  
  223.  
  224. <select name="et-listing-type" id="et-listing-type">
  225. <option value="none"><?php esc_html_e( 'All Time Periods', 'Explorable' ); ?></option>
  226. <?php
  227. if ( $listing_types ) {
  228. foreach( $listing_types as $listing_type ) {
  229. printf( '<option value="%d"%s>%s</option>',
  230. esc_attr( $listing_type->term_id ),
  231. ( isset( $_GET['et-listing-type'] ) && 'none' != $_GET['et-listing-type'] ? selected( intval( $_GET['et-listing-type'] ), $listing_type->term_id, false ) : '' ),
  232. esc_html( $listing_type->name )
  233. );
  234. }
  235. }
  236. ?>
  237. </select>
  238.  
  239. <select name="et-listing-location" id="et-listing-location">
  240. <option value="none"><?php esc_html_e( 'All Locations', 'Explorable' ); ?></option>
  241. <?php
  242. if ( $listing_locations ) {
  243. foreach( $listing_locations as $listing_location ) {
  244. printf( '<option value="%d"%s>%s</option>',
  245. esc_attr( $listing_location->term_id ),
  246. ( isset( $_GET['et-listing-location'] ) && 'none' != $_GET['et-listing-location'] ? selected( intval( $_GET['et-listing-location'] ), $listing_location->term_id, false ) : '' ),
  247. esc_html( $listing_location->name )
  248. );
  249. }
  250. }
  251. ?>
  252.  
  253. </select>
  254.  
  255.  
  256. <select name="et-listing-status" id="et-listing-status">
  257. <option value="none"><?php esc_html_e( 'All Development States', 'Explorable' ); ?></option>
  258. <?php
  259. if ( $listing_statuses ) {
  260. foreach( $listing_statuses as $listing_status ) {
  261. printf( '<option value="%d"%s>%s</option>',
  262. esc_attr( $listing_status->term_id ),
  263. ( isset( $_GET['et-listing-status'] ) && 'none' != $_GET['et-listing-status'] ? selected( intval( $_GET['et-listing-status'] ), $listing_status->term_id, false ) : '' ),
  264. esc_html( $listing_status->name )
  265. );
  266. }
  267. }
  268. ?>
  269.  
  270. </select>
  271.  
  272.  
  273.  
  274.  
  275.  
  276. <button id="et-filter"><?php esc_html_e( 'Filter', 'Explorable' ); ?></button>
  277.  
  278.  
  279.  
  280.  
  281.  
  282. </form>
  283. </div> <!-- .container -->
  284. </div> <!-- #filter-bar -->
  285.  
  286. <div id="et-list-view" class="et-normal-listings">
  287. <h2 id="listing-results"><?php esc_html_e( 'Listing Results', 'Explorable' ); ?></h2>
  288.  
  289. <div id="et-listings">
  290. <div class="scrollbar"><div class="track"><div class="thumb"><div class="end"></div></div></div></div>
  291. <div class="viewport">
  292. <div class="overview">
  293. <ul>
  294. <?php
  295. $i = 1;
  296. while ( have_posts() ) : the_post();
  297. $thumb = '';
  298. $width = (int) apply_filters( 'et_listing_results_image_width', 60 );
  299. $height = (int) apply_filters( 'et_listing_results_image_height', 60 );
  300. $classtext = '';
  301. $titletext = get_the_title();
  302. $thumbnail = get_thumbnail( $width, $height, $classtext, $titletext, $titletext, false, 'ListingIndex' );
  303. $thumb = $thumbnail["thumb"];
  304. ?>
  305. <li class="<?php if ( 1 == $i ) echo esc_attr( 'et-active-listing ' ); ?>clearfix">
  306. <div class="listing-image">
  307. <?php print_thumbnail( $thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext ); ?>
  308. </div> <!-- .listing-image -->
  309. <div class="listing-text">
  310. <h3><?php the_title(); ?></h3>
  311. <p><?php echo wp_strip_all_tags( get_the_term_list( get_the_ID(), 'listing_type', '', ', ' ) ); ?></p>
  312. <?php if ( ( $et_rating = et_get_rating() ) && 0 != $et_rating ) : ?>
  313. <span class="et-rating"><span style="<?php printf( 'width: %dpx;', esc_attr( $et_rating * 17 ) ); ?>"></span></span>
  314. <?php endif; ?>
  315. </div> <!-- .listing-text -->
  316. <a href="<?php the_permalink(); ?>" class="et-mobile-link"><?php esc_html_e( 'Read more', 'Explorable' ); ?></a>
  317. </li>
  318. <?php
  319. $i++;
  320. endwhile;
  321. ?>
  322. </ul>
  323. </div> <!-- .overview -->
  324. </div> <!-- .viewport -->
  325. </div> <!-- #et-listings -->
  326. </div> <!-- #et-list-view -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement