Link map to Google Maps

This commit is contained in:
Brian Miyaji
2019-03-12 16:28:15 +11:00
parent 2da1f2f7b2
commit 7911b082b6
2 changed files with 4 additions and 4 deletions

View File

@@ -33,7 +33,7 @@ if ( ! class_exists( 'SportsPress_OpenStreetMap' ) && get_option( 'sportspress_l
add_action( 'admin_enqueue_scripts', array( $this, 'admin_styles' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'frontend_scripts' ) );
add_action( 'sp_venue_show_openstreetmap', array( $this, 'show_venue_openstreetmap' ), 10, 4 );
add_action( 'sp_venue_show_openstreetmap', array( $this, 'show_venue_openstreetmap' ), 10, 5 );
// Filters
//add_filter( 'sportspress_openstreetmap', array( $this, 'add_options' ) );
@@ -97,9 +97,9 @@ if ( ! class_exists( 'SportsPress_OpenStreetMap' ) && get_option( 'sportspress_l
*
* @return mix
*/
public function show_venue_openstreetmap( $latitude, $longitude, $zoom, $maptype ) {
public function show_venue_openstreetmap( $latitude, $longitude, $address, $zoom, $maptype ) {
?>
<a href="https://www.openstreetmap.org/?mlat=<?php echo $latitude; ?>&amp;mlon=<?php echo $longitude; ?>#map=<?php echo $zoom; ?>/<?php echo $latitude; ?>/<?php echo $longitude; ?>" target="_blank"><div id="sp_openstreetmaps_container" style="width: 100%; height: 320px"></div></a>
<a href="https://www.google.com.au/maps/place/<?php echo $address; ?>/@<?php echo $latitude; ?>,<?php echo $longitude; ?>,<?php echo $zoom; ?>z" target="_blank"><div id="sp_openstreetmaps_container" style="width: 100%; height: 320px"></div></a>
<script>
// position we will use later
var lat = <?php echo $latitude; ?>;

View File

@@ -27,6 +27,6 @@ if ( $latitude != null && $longitude != null ){
if ( get_option( 'sportspress_load_googlemaps_module', 'no' ) == 'yes' ) {
do_action ( 'sp_venue_show_googlemaps', $latitude, $longitude, $address, $zoom, $maptype );
}else{
do_action ( 'sp_venue_show_openstreetmap', $latitude, $longitude, $zoom, $maptype );
do_action ( 'sp_venue_show_openstreetmap', $latitude, $longitude, $address, $zoom, $maptype );
}
}