finally a tuto that seems ok
This commit is contained in:
39
srcs/plugins/google_map/index.php
Executable file → Normal file
39
srcs/plugins/google_map/index.php
Executable file → Normal file
@@ -1,31 +1,19 @@
|
||||
<?php
|
||||
/* Plugin Name: Google Map
|
||||
Plugin URI: https://www.inkthemes.com/
|
||||
Description: Integrate Google Maps on any page or post in a simple way.
|
||||
/* Plugin Name: gmap_test
|
||||
Plugin URI:
|
||||
Description: Integrate Google Maps on any page or post in a simple way
|
||||
Version: 1.0
|
||||
Author: Jaya Rai
|
||||
Author URI: https://www.inkthemes.com/
|
||||
Author: hugogogo
|
||||
Author URI:
|
||||
*/
|
||||
?>
|
||||
|
||||
<?php
|
||||
include_once('debug.php');
|
||||
require_once('get_url.php');
|
||||
?>
|
||||
|
||||
// https://www.inkthemes.com/implement-google-map-plugin-for-wodpress/
|
||||
// Error: Publishing failed. The response is not a valid JSON response.
|
||||
// -> https://wordpress.org/support/topic/publishing-failed-error-message-the-response-is-not-a-valid-json-response-2/
|
||||
// - solution permalink -> broken
|
||||
// - permalink broken : https://wordpress.org/support/topic/permalinks-change-breaks-all-links/
|
||||
// - solution classic editor -> ok
|
||||
|
||||
// https://stackify.com/how-to-log-to-console-in-php/
|
||||
function console_log($output, $with_script_tags = true) {
|
||||
$js_code = 'console.log(' . json_encode($output, JSON_HEX_TAG) .
|
||||
');';
|
||||
if ($with_script_tags) {
|
||||
$js_code = '<script>' . $js_code . '</script>';
|
||||
}
|
||||
echo $js_code;
|
||||
}
|
||||
<?php
|
||||
|
||||
add_action('admin_menu', 'ink_menu_page');
|
||||
function ink_menu_page() {
|
||||
@@ -75,18 +63,17 @@ function show_google_map() {
|
||||
$GoogleMap_Latitude = get_option('googleMap_latitude_position');
|
||||
$GoogleMap_Longitude = get_option('googleMap_longitude_position');
|
||||
$GoogleMap_zoom = get_option('map_zoom_value');
|
||||
|
||||
?>
|
||||
<script
|
||||
//src="https://maps.googleapis.com/maps/api/geocode/json?address=paris&key=AIzaSyCvdGV2ssD4ov4a9CuIlQhoJyz5gWWiSvE
|
||||
?>
|
||||
<script async defer
|
||||
src="http://maps.googleapis.com/maps/api/js?&sensor=false?&key=AIzaSyCvdGV2ssD4ov4a9CuIlQhoJyz5gWWiSvE">
|
||||
</script>
|
||||
<div class="latitude"><?php echo $GoogleMap_Latitude; ?></div>
|
||||
<div class="longitude" ><?php echo $GoogleMap_Longitude; ?></div>
|
||||
<div class="zoom"><?php echo $GoogleMap_zoom; ?></div>
|
||||
<div id="showmap"> </div>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
|
||||
add_shortcode('googlemap', 'show_google_map');
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user