there is a map with a marker, and the docker don't generate a new certificate all the time

This commit is contained in:
lenovo
2022-10-29 17:11:25 +02:00
parent 40963ce3cb
commit 4dca5a4760
15 changed files with 129 additions and 106 deletions

View File

@@ -0,0 +1 @@
/home/www-data//map_prof

31
srcs/plugins/map_prof/map_prof.php Executable file → Normal file
View 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);
?>

View File

@@ -0,0 +1,4 @@
#map {
height: 500px;
width: 100%;
}