post title updater for chantiers
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
5d437581bf
commit
e7fee252e4
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
function metiers_patrimoine_artisant_post_updater($post_id)
|
function metiers_patrimoine_artisans_post_updater($post_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -25,4 +25,33 @@ function metiers_patrimoine_artisant_post_updater($post_id)
|
||||||
// write_log($address);
|
// write_log($address);
|
||||||
wp_update_post($my_post);
|
wp_update_post($my_post);
|
||||||
}
|
}
|
||||||
add_action('acf/save_post', 'metiers_patrimoine_artisant_post_updater', 20);
|
add_action('acf/save_post', 'metiers_patrimoine_artisans_post_updater', 20);
|
||||||
|
|
||||||
|
|
||||||
|
function metiers_patrimoine_chantiers_post_updater($post_id)
|
||||||
|
{
|
||||||
|
if (!$post_id || get_post_type() !== 'chantiers') return;
|
||||||
|
|
||||||
|
$my_post = array();
|
||||||
|
$my_post['ID'] = $post_id;
|
||||||
|
|
||||||
|
$artisan = get_field("artisan", $post_id) ?? "";
|
||||||
|
$chantier_name = get_field("chantier_name", $post_id) ?? "";
|
||||||
|
$date = get_field("date", $post_id) ?? "";
|
||||||
|
$localisation = get_field("localisation", $post_id) ?? "";
|
||||||
|
|
||||||
|
if (!$artisan || !$chantier_name) return;
|
||||||
|
|
||||||
|
$my_post['post_title'] = "";
|
||||||
|
$title = $artisan . " | " . $chantier_name;
|
||||||
|
|
||||||
|
if ($localisation) {
|
||||||
|
$title .= " | " . $localisation;
|
||||||
|
}
|
||||||
|
if ($date) {
|
||||||
|
// $title .= " | " . ;
|
||||||
|
}
|
||||||
|
|
||||||
|
wp_update_post($my_post);
|
||||||
|
}
|
||||||
|
add_action('acf/save_post', 'metiers_patrimoine_chantiers_post_updater', 20);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user