Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Only do a map search if user submitted one
- if( 2 == $_SESSION['s_doing_property_search'] )
- {
- // Only generate map search results if we don't have any yet or if they are a day out of date
- if( empty( $_SESSION['homes_for_' . $type . '_map_search_results'] ) || $_SESSION['homes_for_' . $type . '_map_search_timestamp'] < strtotime( "-1 Day" ) )
- {
- // Load instance of GeoDataStore
- if ( ! isset( $sc_gds ) )
- $sc_gds = new sc_GeoDataStore();
- // Just get the ID's of posts in range
- $_SESSION['homes_for_' . $type . '_map_search_results'] = (array) $sc_gds->getPostIDsOfInRange( "homes-for-" . $type, $_SESSION['s_property_radius'], $_SESSION['s_property_address_lat'], $_SESSION['s_property_address_lng'] );
- // Set a timestamp so we don't do this expensive get each page load.
- $_SESSION['homes_for_' . $type . '_map_search_timestamp'] = time();
- }
- // We we have no results then set an array just one that will trigger no posts found.
- if( empty( $_SESSION['homes_for_' . $type . '_map_search_results'] ) )
- $query->set( 'post__in', array(1) );
- else
- $query->set( 'post__in', $_SESSION['homes_for_' . $type . '_map_search_results'] );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement