error page is more precise with approximates address
This commit is contained in:
@@ -25,6 +25,7 @@ require_once(dirname(__FILE__) . '/settings/mp_optionnals.php');
|
||||
require_once(dirname(__FILE__) . '/mp_get_events.php');
|
||||
require_once(dirname(__FILE__) . '/mp_sort_events.php');
|
||||
require_once(dirname(__FILE__) . '/mp_get_filters.php');
|
||||
require_once(dirname(__FILE__) . '/mp_address_errors.php');
|
||||
|
||||
|
||||
|
||||
@@ -120,6 +121,7 @@ function mp_ljdp_map() {
|
||||
|
||||
$events = mp_get_published_events();
|
||||
$locations = mp_sort_events($events);
|
||||
|
||||
$to_add = array(
|
||||
"locations" => $locations,
|
||||
);
|
||||
@@ -130,8 +132,7 @@ function mp_ljdp_map() {
|
||||
"ville",
|
||||
"categorie",
|
||||
);
|
||||
|
||||
$filters = mp_get_filters($events, $filters_fields);
|
||||
$filters = mp_get_filters($locations, $filters_fields);
|
||||
|
||||
|
||||
/* * * * * * * *
|
||||
@@ -180,31 +181,7 @@ add_shortcode('lejourduprof_map', 'mp_ljdp_map');
|
||||
*/
|
||||
|
||||
function mp_errors_map() {
|
||||
|
||||
$errors = "";
|
||||
$count = 0;
|
||||
|
||||
$get_posts_args = array(
|
||||
'numberposts' => -1,
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'post',
|
||||
);
|
||||
$posts = get_posts($get_posts_args);
|
||||
foreach ($posts as $post) {
|
||||
$id = $post->ID;
|
||||
$coordinate = get_field('coordinates', $id);
|
||||
if ($coordinate == null) {
|
||||
$count++;
|
||||
$errors .= '<br /><p>erreur :</p><p>- article : "';
|
||||
$errors .= $post->post_title . '"</p><p>- adresse : "';
|
||||
$errors .= get_field('adresse', $id) . ', ';
|
||||
$errors .= get_field('ville', $id) . ', ';
|
||||
$errors .= get_field('pays', $id) . '';
|
||||
$errors .= '"</p>';
|
||||
}
|
||||
}
|
||||
$errors = "<p>nombre d'erreurs : " . strval($count) . "</p>" . $errors;
|
||||
return $errors;
|
||||
return mp_find_address_errors();
|
||||
}
|
||||
add_shortcode('ljdp_errors_map', 'mp_errors_map');
|
||||
|
||||
@@ -219,10 +196,11 @@ add_shortcode('ljdp_errors_map', 'mp_errors_map');
|
||||
|
||||
function post_published_coordinates($id, $post) {
|
||||
|
||||
$coordinates = mp_get_coordinates($id);
|
||||
$location = mp_get_coordinates($id);
|
||||
|
||||
if ( ! add_post_meta( $id, 'location', $location, true ) )
|
||||
update_post_meta( $id, 'location', $location );
|
||||
|
||||
if ( ! add_post_meta( $id, 'coordinates', $coordinates, true ) )
|
||||
update_post_meta( $id, 'coordinates', $coordinates );
|
||||
}
|
||||
add_action( 'publish_post', 'post_published_coordinates', 10, 2 );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user