Last active
August 29, 2015 14:25
-
-
Save dboutote/e5d116e7e37112df2a00 to your computer and use it in GitHub Desktop.
Build a link to Bing Map (for WordPress Theme)
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 | |
/** | |
* Build a link to Bing Maps | |
* | |
* @since 1.0 | |
* | |
* @param string $lat the requested Latitude of the location. Required, default is empty. | |
* @param string $lng the requested Longitude of the location. Required, default is empty. | |
* @return mixed The url if successful. Empty otherwise. | |
*/ | |
function _get_bing_url( $lat = '', $lng = '' ){ | |
if( !$lat || !$lng ){ | |
return ''; | |
} | |
$url = add_query_arg( | |
array( | |
'cp' => $lat . '~' . $lng, | |
'lvl' => '17', | |
'style' => 'a' | |
), | |
'//bing.com/maps/default.aspx' | |
); | |
return $url; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment