create plugin menu and message if posts without address
This commit is contained in:
@@ -38,6 +38,8 @@ require_once(dirname(__FILE__) . '/srcs/map_posts/mp_post_events_pages.php');
|
||||
require_once(dirname(__FILE__) . '/srcs/publish/mp_get_coordinates.php');
|
||||
require_once(dirname(__FILE__) . '/srcs/publish/mp_update_publish.php');
|
||||
|
||||
require_once(dirname(__FILE__) . '/srcs/menu/mp_menu_content.php');
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -54,8 +56,8 @@ 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);
|
||||
mp_console_log("events :");
|
||||
mp_console_log($events);
|
||||
// foreach ($events as $event) {
|
||||
// mp_console_log("--------------- event :");
|
||||
// mp_console_log("id: " . $event->id);
|
||||
@@ -95,10 +97,11 @@ 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');
|
||||
// function mp_add_update_button() {
|
||||
// return mp_create_republish_button();
|
||||
// }
|
||||
// add_shortcode('ljdp_update_publish', 'mp_add_update_button');
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -121,14 +124,35 @@ add_shortcode('ljdp_errors_map', 'mp_errors_map');
|
||||
* 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);
|
||||
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');
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user