categorie) === "array") { // mp_console_log($event->categorie); // } // if (str_starts_with($event->categorie, '["')) { // mp_console_log($event->categorie); // } //} $locations = mp_sort_events($events); // mp_get_locations.php //mp_console_log("locations: "); //mp_console_log($locations); $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, "jipf_events" => $events, )); return mp_create_div($filters); } add_shortcode('lejourduprof_map', 'mp_ljdp_map'); /* script in divi : */ /** * 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( 'JIPF map', // page_title 'JIPF 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'); ?>