From dff2a50c35d4e8e0bf8332573f43ee1fa174cdff Mon Sep 17 00:00:00 2001 From: Antoine M Date: Fri, 22 Nov 2024 10:31:08 +0100 Subject: [PATCH] handling location and date for post title updater --- includes/artisans.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/includes/artisans.php b/includes/artisans.php index e3d4661..566136e 100644 --- a/includes/artisans.php +++ b/includes/artisans.php @@ -42,16 +42,15 @@ function metiers_patrimoine_chantiers_post_updater($post_id) if (!$artisan || !$chantier_name) return; - $my_post['post_title'] = ""; - $title = $artisan . " | " . $chantier_name; + $title = $artisan->post_title . " | " . $chantier_name; - if ($localisation) { - $title .= " | " . $localisation; + if ($localisation && isset($localisation['city'])) { + $title .= " | " . $localisation['city']; } if ($date) { - // $title .= " | " . ; + $title .= " | " . $date; } - + $my_post['post_title'] = $title; wp_update_post($my_post); } add_action('acf/save_post', 'metiers_patrimoine_chantiers_post_updater', 20);