Skip to content

Instantly share code, notes, and snippets.

@audrasjb
Last active August 26, 2022 22:12
Show Gist options
  • Select an option

  • Save audrasjb/7fa31a00a98537b62f825be60cda3812 to your computer and use it in GitHub Desktop.

Select an option

Save audrasjb/7fa31a00a98537b62f825be60cda3812 to your computer and use it in GitHub Desktop.
<?php
function declare_geo_shortcodes() {
add_shortcode( 'geoLink', 'geo_shortcode_link' );
add_shortcode( 'geoMap', 'geo_shortcode_map' );
}
add_action( 'init', 'declare_geo_shortcodes' );
function geo_shortcode_link() {
$html = "<link rel='stylesheet' href='https://unpkg.com/leaflet@1.8.0/dist/leaflet.css'
integrity='sha512-hoalWLoI8r4UszCkZ5kL8vayOGVae1oxXe/2A4AO6J9+580uKHDO3JdHb7NzwwzK5xr/Fs0W40kiNHxM9vyTtQ=='
crossorigin=''/>
<script src='https://unpkg.com/leaflet@1.8.0/dist/leaflet.js'
integrity='sha512-BB3hKbKWOc9Ez/TAwyWxNXeoV9c1v6FIeYiBieIWkpLjauysF18NzgR1MBNBXf8/KABdlkX68nAhlwcDFLGPCQ=='
crossorigin=''></script>
<script type='text/javascript' src='../wp-content/plugins/sauron/includes/geo.js'></script>
<style>
#map {
height: 750px;
width: 750px;
}
</style>";
return $html;
}
function geo_shortcode_map() {
$html = "<span>Latitude : </span><span id='latitude'></span>
<span>Longitude : </span><span id='longitude'></span>
<div id='map'></div>";
return $html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment