wip trying to figure what fields to use

This commit is contained in:
asus
2023-09-21 11:35:22 +02:00
parent 94de259361
commit ce86b72dd8
4 changed files with 182 additions and 34 deletions

View File

@@ -54,23 +54,24 @@ function mp_ljdp_map() {
mp_enqueue_scripts_and_styles();
$events = mp_get_published_events(); // mp_get_events.php
mp_console_log("events :");
mp_console_log($events);
foreach ($events as $event) {
mp_console_log($event);
$event_id = $event->id;
mp_console_log($event_id);
$fields = get_fields($event_id);
mp_console_log($fields);
// mp_console_log("events :");
// mp_console_log($events);
// foreach ($events as $event) {
// mp_console_log("--------------- event :");
// mp_console_log("id: " . $event->id);
// mp_console_log("adresse: " . $event->adresse);
// mp_console_log("pays: " . $event->pays);
// mp_console_log("ville: " . $event->ville);
// mp_console_log("irl: " . $event->irl);
// mp_console_log($event);
//
// $fields = get_fields($event_id);
// mp_console_log($fields);
// foreach( $fields as $name => $value )
// mp_console_log($name . " : " . $value);
}
// }
$locations = mp_sort_events($events); // mp_get_locations.php
mp_console_log("locations :");
mp_console_log($locations);
foreach ($locations as $location)
mp_console_log($location);
$filters = mp_get_filters($events); // mp_get_filters.php
@@ -118,16 +119,16 @@ add_shortcode('ljdp_errors_map', 'mp_errors_map');
/**
* when a post is saved or published or updated,
* find its coordinates
function post_published_coordinates($id, $post) {
$location = mp_get_coordinates($id);
if ( ! add_post_meta( $id, 'location', $location, true ) )
update_post_meta( $id, 'location', $location );
}
add_action( 'publish_post', 'post_published_coordinates', 10, 2 );
*/
// function post_published_coordinates($id, $post) {
//
// $location = mp_get_coordinates($id);
//
// if ( ! add_post_meta( $id, 'location', $location, true ) )
// update_post_meta( $id, 'location', $location );
//
// }
// add_action( 'publish_post', 'post_published_coordinates', 10, 2 );
?>