Created
May 8, 2020 18:37
-
-
Save wpscholar/65478ee74ae4cb71f12f955ae6103e6b to your computer and use it in GitHub Desktop.
A custom Stellar Places template to show nearby places.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$place = Stellar_Places::get_place_object( get_post() ); | |
$nearby = Stellar_Places::get_places( | |
array( | |
'post__not_in' => array( get_the_ID() ), | |
'geo_query' => array( | |
'lat' => $place->latitude, | |
'lng' => $place->longitude, | |
'distance' => 1, | |
), | |
) | |
); | |
$address = Stellar_Places::get_postal_address( $place ); | |
$stellar_map = Stellar_Places::get_map( $place ); | |
foreach ( $nearby as $location ) { | |
$location->icon = 'https://maps.google.com/mapfiles/ms/icons/blue-dot.png'; | |
$stellar_map->add_location( $location ); | |
} | |
$stellar_map->latitude = $place->latitude; | |
$stellar_map->longitude = $place->longitude; | |
$stellar_map->autoCenter = false; | |
$stellar_map->autoZoom = false; | |
$stellar_map->mapOptions['zoom'] = 15; | |
?> | |
<div class="stellar-places-single"> | |
<?php $stellar_map->render(); ?> | |
<span class="stellar-places-postal-address formatted"> | |
<?php $address->render(); ?> | |
</span> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment