FEATURE Introducing equipe post type
This commit is contained in:
parent
5706b8ed6c
commit
13c552d326
|
|
@ -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
24
includes/equipe.php
Normal 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
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user