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 $filters = mp_get_filters($events); // mp_get_filters.php // if post event instead of map page, change coordinate and zoom mp_post_event_pages_setting(); mp_add_to_scripts(array( "locations" => $locations, "filters" => $filters, )); return mp_create_div($filters); } add_shortcode('lejourduprof_map', 'mp_ljdp_map'); /** * re-publish posts */ // function mp_add_update_button() { // return mp_create_republish_button(); // } // add_shortcode('ljdp_update_publish', 'mp_add_update_button'); /** * errors map */ function mp_errors_map() { return mp_find_address_errors(); } 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); mp_console_log("location: "); mp_console_log($location); // if ( ! add_post_meta( $id, 'location', $location, true ) ) // update_post_meta( $id, 'location', $location ); } add_action( 'publish_post', 'post_published_coordinates', 10, 2 ); /** * menu plugin */ function ljdp_map_menu() { add_menu_page( 'ljdp map', // page_title 'ljdp map', // menu_title 'manage_options', // capability 'ljdp-map-plugin', // menu_slug 'ljdp_map_plugin_content' // callback function to display page content ); } add_action('admin_menu', 'ljdp_map_menu'); ?>