handlingpost-type rename
This commit is contained in:
parent
332a7eb30a
commit
43410a9337
|
|
@ -26,9 +26,28 @@ function metiers_patrimoine_create_posttype()
|
||||||
|
|
||||||
|
|
||||||
'menu_position' => 5.1,
|
'menu_position' => 5.1,
|
||||||
'supports' => array('title', 'custom-fields'),
|
'supports' => array('title', 'custom-fields', 'thumbnail'),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action('init', 'metiers_patrimoine_create_posttype');
|
add_action('init', 'metiers_patrimoine_create_posttype');
|
||||||
|
|
||||||
|
|
||||||
|
function metiers_patrimoine_artisant_post_title_updater($post_id)
|
||||||
|
{
|
||||||
|
if (!$post_id) return;
|
||||||
|
|
||||||
|
$my_post = array();
|
||||||
|
$my_post['ID'] = $post_id;
|
||||||
|
$name = get_field("name", $post_id);
|
||||||
|
|
||||||
|
if (get_post_type() == 'artisans' && $name) {
|
||||||
|
$my_post['post_title'] = "";
|
||||||
|
$my_post['post_title'] = $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wp_update_post($my_post);
|
||||||
|
}
|
||||||
|
add_action('acf/save_post', 'metiers_patrimoine_artisant_post_title_updater', 20);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user