trying to get scf fields

This commit is contained in:
asus
2023-09-18 15:45:59 +02:00
parent 3632c97347
commit 94de259361
5 changed files with 61 additions and 171 deletions

View File

@@ -32,33 +32,33 @@
- 03/09/23 - 03/09/23
- begin: 14h30 - begin: 14h30
- mes: "setting up docker" - mes: "setting up docker"
- end: 16h - end: 16h00
- len: 1h30 - len: 1h30
- begin: 16h30 - begin: 16h30
- mes: "launch worpdress" - mes: "launch worpdress"
- end: 18h - end: 18h00
- len: 1h30 - len: 1h30
- total: 3h - total: 3h00
- money: 90€ - money: 90€
- 09/09/23 - 09/09/23
- begin: 16h30 - begin: 16h30
- mes: "trying to copy wp site" - mes: "trying to copy wp site"
- end: 17h30 - end: 17h30
- len: 1h - len: 1h00
- total: 1h - total: 1h00
- money: 30€ - money: 30€
- 10/09/23 - 10/09/23
- begin: 10h - begin: 10h00
- mes: "trying to fix makefile and .env volume variable" - mes: "trying to fix makefile and .env volume variable"
- end: 12h - end: 12h00
- len: 2h - len: 2h00
- total: 2h - total: 2h00
- money: 60€ - money: 60€
- 11/09/23 - 11/09/23
- begin: 10h - begin: 10h00
- mes: "fixed volume variable" - mes: "fixed volume variable"
- end: 13h30 - end: 13h30
- len: 3h30 - len: 3h30
@@ -76,9 +76,9 @@
- 14/09/23 - 14/09/23
- begin: 11h30 - begin: 11h30
- mes: "resolve env pbm with sudo" - mes: "resolve env pbm with sudo"
- end: 12h - end: 12h00
- len: 0h30 - len: 0h30
- begin: 13h - begin: 13h00
- mes: "env pbm with sudo resolved" - mes: "env pbm with sudo resolved"
- end: 13h45 - end: 13h45
- len: 0h45 - len: 0h45
@@ -93,13 +93,17 @@
- total: 2h45 - total: 2h45
- money: 82€50 - money: 82€50
- 15/09/23 - 18/09/23
- begin: h - begin: 10h00
- mes: "start on plugin" - mes: "rediscover plugin"
- end: h - end: 12h00
- len: h - len: 2h00
- total: h - begin: 13h00
- money: € - mes: "try to get acf fields"
- end: 15h45
- len: 2h45
- total: 4h45
- money: 142€50
#### total : 90 + 30 = 120€ #### total : 90 + 30 = 120€

View File

@@ -53,9 +53,27 @@ function mp_ljdp_map() {
mp_enqueue_scripts_and_styles(); mp_enqueue_scripts_and_styles();
$events = mp_get_published_events(); $events = mp_get_published_events(); // mp_get_events.php
$locations = mp_sort_events($events); mp_console_log("events :");
$filters = mp_get_filters($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);
// 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
// if post event instead of map page, change coordinate and zoom // if post event instead of map page, change coordinate and zoom
mp_post_event_pages_setting(); mp_post_event_pages_setting();
@@ -65,7 +83,6 @@ function mp_ljdp_map() {
)); ));
return mp_create_div($filters); return mp_create_div($filters);
} }
add_shortcode('lejourduprof_map', 'mp_ljdp_map'); add_shortcode('lejourduprof_map', 'mp_ljdp_map');
@@ -101,7 +118,6 @@ add_shortcode('ljdp_errors_map', 'mp_errors_map');
/** /**
* when a post is saved or published or updated, * when a post is saved or published or updated,
* find its coordinates * find its coordinates
*/
function post_published_coordinates($id, $post) { function post_published_coordinates($id, $post) {
@@ -112,141 +128,6 @@ function post_published_coordinates($id, $post) {
} }
add_action( 'publish_post', 'post_published_coordinates', 10, 2 ); add_action( 'publish_post', 'post_published_coordinates', 10, 2 );
/**
* trying to prevent publication with message if bad country address
*/ */
// // notice on post edit :
// // https://developer.wordpress.org/block-editor/how-to-guides/notices/
// // https://developer.wordpress.org/block-editor/how-to-guides/javascript/loading-javascript/
// // https://developer.wordpress.org/block-editor/reference-guides/components/notice/https://developer.wordpress.org/block-editor/reference-guides/components/notice/
// // modals : https://developer.wordpress.org/block-editor/reference-guides/components/modal/
//
// // https://www.wpbeginner.com/wp-tutorials/how-to-add-admin-notices-in-wordpress/
// // https://digwp.com/2016/05/wordpress-admin-notices/
// function my_notice() {
// //echo '<div class="notice notice-warning is-dismissible">
// //echo '<div class="notice notice-info is-dismissible">
// //echo '<div class="notice notice-success is-dismissible">
// //echo '<div class="components-notice is-error is-dismissible">
// // echo '
// // <div class="notice notice-error is-dismissible">
// // <p>my message</p>
// // </div>
// // ';
//
// mp_console_log("\n get values:");
// foreach ($_GET as $key => $value) {
// mp_console_log(" " . $key . ": " . $value);
// }
// $screen = get_current_screen();
// mp_console_log("\n screen values:");
// foreach ($screen as $key => $value) {
// mp_console_log(" " . $key . ": " . $value);
// }
// }
// add_action( 'admin_notices', 'my_notice');
//
// // https://wordpress.stackexchange.com/questions/42013/prevent-post-from-being-published-if-custom-fields-not-filled
// // https://developer.wordpress.org/reference/hooks/save_post/
// function my_publish_check($id, $post, $update) {
//
// // is doing autosaving ?
// if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
// return;
//
// // is post creation ?
// if (!$update)
// return;
//
// // if this is a revision, get real post ID
// if ( $parent_id = wp_is_post_revision( $id ) )
// $id = $parent_id;
//
// // is the user allowed to edit the post or page ?
// if ( !current_user_can( 'edit_post', $id ) )
// return;
//
// // is not being published ?
// if ($post->post_status != "publish")
// return;
//
// $prevent_publish= true; // set to true if data was invalid
// if ($prevent_publish) {
//
// // unhook this function to prevent indefinite loop
// remove_action('save_post', 'my_save_post');
//
// // update the post to change post status
// wp_update_post(array('ID' => $id, 'post_status' => 'draft'));
//
// // re-hook this function again
// add_action('save_post', 'my_save_post');
// }
// }
// add_action( 'save_post_post', 'my_publish_check', 10, 3);
//
// function publish_error() {
// wp_enqueue_script('mp_publish_error',
// plugins_url('scripts/mp_publish_error.js', __FILE__),
// array( 'wp-data' ),
// '',
// true
// );
// }
// add_action( 'enqueue_block_editor_assets', 'publish_error');
//
// // https://wordpress.stackexchange.com/questions/42013/prevent-post-from-being-published-if-custom-fields-not-filled
// // https://wordpress.stackexchange.com/questions/15546/dont-publish-custom-post-type-post-if-a-meta-data-field-isnt-valid
// function my_redirect_location($location, $post_id) {
//
// // if post was published...
// if (isset($_POST['publish'])){
//
// // obtain current post status
// $status = get_post_status( $post_id );
//
// // the post was 'published', but if it is still a draft, display draft message (10).
// if($status=='draft') {
// $location = add_query_arg('message', 10, $location);
// }
// }
//
// return $location;
// }
// add_filter('redirect_post_location', 'my_redirect_location', 10, 2);
//
// //function test1($id, $post) {
// // mp_console_log("save_post - " . $post->post_status);
// //}
// //add_action( 'save_post', 'test1', 10, 2 );
// /*
// modification rapide, publie -> brouillon : 1 - draft
// modification rapide, brouillon -> brouillon : 1 - draft
// modification rapide, brouillon -> publie : 1 - publish
// add post : 1 - auto-draft
// modification, publie -> brouillon : 2 - draft
// modification, brouillon -> brouillon : 2 - draft
// modification, brouillon -> publie : 2 - publish
// */
//
// //function test2($id, $post) {
// // mp_console_log("publish_post - " . $post->post_status);
// //}
// //add_action( 'publish_post', 'test2', 10, 2 );
// /*
// modification rapide, publie -> brouillon : /
// modification rapide, brouillon -> brouillon : /
// modification rapide, brouillon -> publie : 1 - publish
// add post : /
// modification, publie -> brouillon : /
// modification, brouillon -> brouillon : /
// modification, brouillon -> publie : 2 - publish
// */
?> ?>

View File

@@ -5,21 +5,21 @@ function mp_enqueue_scripts_and_styles() {
// https://developers.google.com/maps/documentation/javascript/marker-clustering // https://developers.google.com/maps/documentation/javascript/marker-clustering
$marker_clusterer = "https://unpkg.com/@googlemaps/markerclusterer/dist/index.min.js"; $marker_clusterer = "https://unpkg.com/@googlemaps/markerclusterer/dist/index.min.js";
wp_enqueue_style('mp__style', plugins_url('styles/mp__style.css' , __FILE__), '', '', false); wp_enqueue_style('mp__style', plugins_url('styles/mp__style.css' , __FILE__), '', '', false);
// enqueue header // enqueue header
wp_enqueue_script('mp_info_window', plugins_url('scripts/mp_info_window.js' , __FILE__), '', '', false); wp_enqueue_script('mp_info_window', plugins_url('scripts/mp_info_window.js' , __FILE__), '', '', false);
wp_enqueue_script('mp_errors_map', plugins_url('scripts/mp_errors_map.js' , __FILE__), '', '', false); wp_enqueue_script('mp_errors_map', plugins_url('scripts/mp_errors_map.js' , __FILE__), '', '', false);
wp_enqueue_script('mp_create_filters', plugins_url('scripts/mp_create_filters.js' , __FILE__), '', '', false); wp_enqueue_script('mp_create_filters', plugins_url('scripts/mp_create_filters.js' , __FILE__), '', '', false);
wp_enqueue_script('mp_create_markers', plugins_url('scripts/mp_create_markers.js' , __FILE__), '', '', false); wp_enqueue_script('mp_create_markers', plugins_url('scripts/mp_create_markers.js' , __FILE__), '', '', false);
wp_enqueue_script('mp_create_map', plugins_url('scripts/mp_create_map.js' , __FILE__), '', '', false); wp_enqueue_script('mp_create_map', plugins_url('scripts/mp_create_map.js' , __FILE__), '', '', false);
wp_enqueue_script('mp_draw_clusters', plugins_url('scripts/mp_draw_clusters.js' , __FILE__), '', '', false); wp_enqueue_script('mp_draw_clusters', plugins_url('scripts/mp_draw_clusters.js' , __FILE__), '', '', false);
wp_enqueue_script('mp_filter_events', plugins_url('scripts/mp_filter_events.js' , __FILE__), '', '', false); wp_enqueue_script('mp_filter_events', plugins_url('scripts/mp_filter_events.js' , __FILE__), '', '', false);
// enqueue footer // enqueue footer
wp_enqueue_script('mp_marker_clusterer', $marker_clusterer, '', '', true); wp_enqueue_script('mp_marker_clusterer', $marker_clusterer, '', '', true);
wp_enqueue_script('mp_init_map', plugins_url('scripts/mp_init_map.js' , __FILE__), ['mp_marker_clusterer'],'', true); wp_enqueue_script('mp_init_map', plugins_url('scripts/mp_init_map.js' , __FILE__), ['mp_marker_clusterer'],'', true);
wp_enqueue_script('mp_google_api', mp_url_api(), ['mp_init_map'], '', true); wp_enqueue_script('mp_google_api', mp_url_api(), ['mp_init_map'], '', true);
} }

View File

@@ -5,6 +5,7 @@
*/ */
/* cle api de google maps */ /* cle api de google maps */
$mp_api_key = 'AIzaSyCvdGV2ssD4ov4a9CuIlQhoJyz5gWWiSvE'; //$mp_api_key = 'AIzaSyCvdGV2ssD4ov4a9CuIlQhoJyz5gWWiSvE';
$mp_api_key = 'AIzaSyBNWx_3vuMKQr_nJbFKNBx6-x7NXwVqSwE';
?> ?>

View File

@@ -1,5 +1,7 @@
<?php <?php
/*
function mp_update_publish() { function mp_update_publish() {
$post_args = array( $post_args = array(
'numberposts' => -1, 'numberposts' => -1,
@@ -41,4 +43,6 @@ function mp_create_republish_button() {
return $content; return $content;
} }
*/
?> ?>