FEATURE Introducing equipe post type

This commit is contained in:
Antoine M 2025-11-25 15:15:11 +01:00
parent 5706b8ed6c
commit 13c552d326
2 changed files with 25 additions and 0 deletions

View File

@ -11,6 +11,7 @@ require_once(__DIR__ . '/includes/nawalker_fction.php');
require_once(__DIR__ . '/includes/social-networks.php');
require_once(__DIR__ . '/includes/forms.php');
require_once(__DIR__ . '/includes/rapport-activites.php');
require_once(__DIR__ . '/includes/equipe.php');
// require_once(__DIR__ . '/includes/widget.php');

24
includes/equipe.php Normal file
View File

@ -0,0 +1,24 @@
<?php
add_action('acf/save_post', 'carhop_save_equipe_post');
function carhop_save_equipe_post($post_id)
{
$post_type = get_post_type($post_id);
if ($post_type == 'equipe') {
$first_name = get_field('first_name', $post_id) ?? '';
$last_name = get_field('last_name', $post_id) ?? '';
$full_name = $first_name . ' ' . $last_name;
if ($full_name && $full_name != '') {
$post_slug = sanitize_title($full_name);
wp_update_post(array(
'ID' => $post_id,
'post_title' => $full_name,
'post_name' => $post_slug
));
}
}
}