there is a map with a marker, and the docker don't generate a new certificate all the time
This commit is contained in:
1
srcs/plugins/google_map/google_map
Symbolic link
1
srcs/plugins/google_map/google_map
Symbolic link
@@ -0,0 +1 @@
|
||||
/home/www-data//google_map
|
||||
@@ -56,6 +56,7 @@ function my_init_script() {
|
||||
wp_enqueue_script('my_script', $script_path, array('jquery'));
|
||||
$style_path = plugins_url('style.css', __FILE__);
|
||||
wp_enqueue_style('my_style', $style_path);
|
||||
console_log("urlencode : " . urlencode("128 rue de la croix nivert, paris"));
|
||||
}
|
||||
|
||||
function show_google_map() {
|
||||
@@ -65,7 +66,7 @@ function show_google_map() {
|
||||
$GoogleMap_zoom = get_option('map_zoom_value');
|
||||
//src="https://maps.googleapis.com/maps/api/geocode/json?address=paris&key=AIzaSyCvdGV2ssD4ov4a9CuIlQhoJyz5gWWiSvE
|
||||
?>
|
||||
<script async defer
|
||||
<script
|
||||
src="http://maps.googleapis.com/maps/api/js?&sensor=false?&key=AIzaSyCvdGV2ssD4ov4a9CuIlQhoJyz5gWWiSvE">
|
||||
</script>
|
||||
<div class="latitude"><?php echo $GoogleMap_Latitude; ?></div>
|
||||
|
||||
1
srcs/plugins/map_prof/map_prof
Symbolic link
1
srcs/plugins/map_prof/map_prof
Symbolic link
@@ -0,0 +1 @@
|
||||
/home/www-data//map_prof
|
||||
31
srcs/plugins/map_prof/map_prof.php
Executable file → Normal file
31
srcs/plugins/map_prof/map_prof.php
Executable file → Normal file
@@ -1,8 +1,4 @@
|
||||
<?php
|
||||
/**
|
||||
* @package map_prof
|
||||
* @version 1.0.0
|
||||
*/
|
||||
/*
|
||||
Plugin Name: map_prof
|
||||
Plugin URI:
|
||||
@@ -12,6 +8,12 @@ Version: 1.0.0
|
||||
Author URI:
|
||||
*/
|
||||
|
||||
add_action( 'init', 'my_init_script' );
|
||||
function my_init_script() {
|
||||
$style_path = plugins_url('style.css', __FILE__);
|
||||
wp_enqueue_style('my_style', $style_path);
|
||||
}
|
||||
|
||||
// if bock theme : https://wordpress.org/support/topic/twenty-twenty-two-cpt-template-error-theme-without-header-is-deprecated/
|
||||
function add_map_api(){
|
||||
?>
|
||||
@@ -43,7 +45,7 @@ function print_content($content){
|
||||
|
||||
// print only on the page 'map', and other conditions
|
||||
// https://developer.wordpress.org/reference/hooks/the_content/
|
||||
if (!( is_page('map') && in_the_loop() && is_main_query() ))
|
||||
if (!( is_page('map_prof') && in_the_loop() && is_main_query() ))
|
||||
return $content;
|
||||
|
||||
// https://developer.wordpress.org/reference/functions/get_posts/
|
||||
@@ -90,9 +92,24 @@ function print_content($content){
|
||||
// $content .= "</p>";
|
||||
//}
|
||||
|
||||
//$content .= "<div id='map'><p>OSM map 2</p></div>";
|
||||
$content .= '<div id="map"></div>';
|
||||
$content .= '<script>
|
||||
function initMap() {
|
||||
var location = {lat: 38.8833, lng: -77.0167};
|
||||
var map = new google.maps.Map(document.getElementById("map"), {
|
||||
zoom: 12,
|
||||
center: location
|
||||
});
|
||||
var marker = new google.maps.Marker({
|
||||
position: location,
|
||||
map: map
|
||||
});
|
||||
}
|
||||
</script>';
|
||||
$content .= '<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCvdGV2ssD4ov4a9CuIlQhoJyz5gWWiSvE&callback=initMap"></script>';
|
||||
|
||||
return $content;
|
||||
};
|
||||
//add_action('the_content', 'print_content', 1);
|
||||
add_action('the_content', 'print_content', 1);
|
||||
|
||||
?>
|
||||
|
||||
4
srcs/plugins/map_prof/style.css
Normal file
4
srcs/plugins/map_prof/style.css
Normal file
@@ -0,0 +1,4 @@
|
||||
#map {
|
||||
height: 500px;
|
||||
width: 100%;
|
||||
}
|
||||
Reference in New Issue
Block a user