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);