diff --git a/:w b/:w new file mode 100644 index 0000000..500be48 --- /dev/null +++ b/:w @@ -0,0 +1,132 @@ +'; + return $mp_api_script; +} +function mp_add_api() { + $mp_create_url = array( + 'src' => 'https://maps.googleapis.com/maps/api/js', + 'key' => 'AIzaSyCvdGV2ssD4ov4a9CuIlQhoJyz5gWWiSvE', + 'callback' => 'mp_init_map', + ); + $mp_src = ""; + foreach ($mp_create_url as $url_key => $url_value) { + if ($url_key === 'src') { + $mp_src .= $url_value; + if (count($mp_create_url > 1)) + $mp_src .= "?"; + } + else + $mp_src .= "&" . $url_key . "=" . $url_value; + }; + + $mp_api_script = ''; + return $mp_api_script; +} +function show_map() { + $mp_api_script = mp_add_div(); + $mp_api_script .= mp_add_api(); + return $mp_api_script; +} +add_shortcode('lejourduprof_map', 'show_map'); +//add_shortcode('lejourduprof_map', 'mp_add_div'); + + +//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_prof') && in_the_loop() && is_main_query() )) +// return $content; +// +// // https://developer.wordpress.org/reference/functions/get_posts/ +// $get_posts_args = array( +// 'numberposts' => -1, +// 'post_status' => 'publish', +// ); +// +// $posts_list = get_posts($get_posts_args); +// $content .= "
"; +// $content .= "nb posts published : "; +// $content .= count($posts_list); +// $content .= "
"; +// foreach ($posts_list as $post_value) { +// $content .= ""; +// //$content .= "nb posts published : "; +// //$content .= count($posts_list); +// //$content .= "
"; +// //foreach ($posts_list as $post_key => $post_value) { +// // $content .= "";
+// // $content .= "post content : ";
+// // $content .= $post_key;
+// // $content .= " : ";
+// // $content .= "
";
+// // foreach ($post_value as $key => $value) {
+// // $content .= "- [";
+// // $content .= $key;
+// // $content .= "]: [";
+// // $content .= $value;
+// // $content .= "]
";
+// // }
+// // $content .= "