times
This commit is contained in:
10
README.md
10
README.md
@@ -126,11 +126,11 @@
|
||||
- end: 12h45
|
||||
- len: 3h00
|
||||
- begin: 15h15
|
||||
- mes: ""
|
||||
- end: h
|
||||
- len: 3h
|
||||
- total: h
|
||||
- money: €
|
||||
- mes: "create plugin menu"
|
||||
- end: 19h30
|
||||
- len: 4h15
|
||||
- total: 7h15
|
||||
- money: 217€50
|
||||
|
||||
|
||||
#### total : 90 + 30 = 120€
|
||||
|
||||
@@ -130,8 +130,8 @@ function post_published_coordinates($id, $post) {
|
||||
mp_console_log("location: ");
|
||||
mp_console_log($location);
|
||||
|
||||
// if ( ! add_post_meta( $id, 'location', $location, true ) )
|
||||
// update_post_meta( $id, 'location', $location );
|
||||
if ( ! add_post_meta( $id, 'location', $location, true ) )
|
||||
update_post_meta( $id, 'location', $location );
|
||||
|
||||
}
|
||||
add_action( 'publish_post', 'post_published_coordinates', 10, 2 );
|
||||
|
||||
@@ -45,8 +45,6 @@ function mp_have_no_coordinates($posts_list) {
|
||||
$posts_no_coordinates = [];
|
||||
foreach ($posts_list as $post) {
|
||||
$location = get_field("location", $post->ID);
|
||||
mp_console_log("location: ");
|
||||
mp_console_log($location);
|
||||
if (empty($location))
|
||||
array_push($posts_no_coordinates, $post);
|
||||
else if (empty($location->coordinates))
|
||||
@@ -148,18 +146,18 @@ function mp_show_list_posts_no_coordinates($posts) {
|
||||
function ljdp_map_plugin_content() {
|
||||
|
||||
$posts_list = mp_get_all_posts();
|
||||
mp_console_log("posts_list: ");
|
||||
mp_console_log($posts_list);
|
||||
//mp_console_log("posts_list: ");
|
||||
//mp_console_log($posts_list);
|
||||
|
||||
$posts_published = mp_posts_published($posts_list);
|
||||
|
||||
$posts_no_address = mp_have_no_address($posts_list);
|
||||
mp_console_log("posts_no_address: ");
|
||||
mp_console_log($posts_no_address);
|
||||
//mp_console_log("posts_no_address: ");
|
||||
//mp_console_log($posts_no_address);
|
||||
|
||||
$posts_no_coordinates = mp_have_no_coordinates($posts_list);
|
||||
mp_console_log("posts_no_coordinates: ");
|
||||
mp_console_log($posts_no_coordinates);
|
||||
//mp_console_log("posts_no_coordinates: ");
|
||||
//mp_console_log($posts_no_coordinates);
|
||||
|
||||
echo <<<HTML
|
||||
<div>
|
||||
|
||||
@@ -31,7 +31,11 @@ function mp_get_coordinates($id) {
|
||||
. '?language=fr'
|
||||
. '&address=' . urlencode($address)
|
||||
. '&key=' . $mp_api_key;
|
||||
mp_console_log("geolocation:");
|
||||
mp_console_log($geolocation);
|
||||
$jsoncontent = file_get_contents($geolocation);
|
||||
mp_console_log("jsoncontent:");
|
||||
mp_console_log($jsoncontent);
|
||||
|
||||
// extract coordinates from json
|
||||
// https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types
|
||||
|
||||
Reference in New Issue
Block a user