From 46284d8e07c779a38f4318ba0262f37eb3123263 Mon Sep 17 00:00:00 2001 From: Antoine M Date: Thu, 30 Jan 2025 10:40:13 +0100 Subject: [PATCH] declaring custom taxonomies --- includes/taxonomy.php | 84 +++++++++++++++++++++++++++++++------------ 1 file changed, 62 insertions(+), 22 deletions(-) diff --git a/includes/taxonomy.php b/includes/taxonomy.php index 59cab9f..4ae5fd5 100644 --- a/includes/taxonomy.php +++ b/includes/taxonomy.php @@ -1,26 +1,66 @@ true, + + +// ######################@ + + +/* ------------------- + REGISTER TAXONOMIES + --------------------*/ + +function homegrade_add_custom_taxonomies() +{ + + + // ————— Thématiques ————— + register_taxonomy('project_type', ['portfolio'], array( + // 'hierarchical' => true, 'labels' => array( - 'name' => __('Catégories', 'customer'), - 'singular_name' => __('Catégories', 'nom du theme'), - 'search_items' => __('Rechercher une catégorie', 'nom du theme'), - 'all_items' => __('Toutes les catégories', 'nom du theme'), - 'parent_item' => __('Catégorie parente', 'nom du theme'), - 'parent_item_colon' => __('Catégorie parente :', 'nom du theme'), - 'edit_item' => __('Éditer une catégorie', 'nom du theme'), - 'update_item' => __('Sauvegarder une catégorie', 'nom du theme'), - 'add_new_item' => __('Ajouter une catégorie', 'nom du theme'), - 'new_item_name' => __('Nouvelle catégorie', 'nom du theme') + 'name' => __('Type de projet', 'deligraph-theme'), + 'singular_name' => __('Type de projet', 'deligraph-theme'), + 'search_items' => __('Chercher un type de projet', 'deligraph-theme'), + 'all_items' => __('Touts les Types de projet', 'deligraph-theme'), + 'parent_item' => __('Type de projet Parent', 'deligraph-theme'), + 'parent_item_colon' => __('Type de projet Parent:', 'deligraph-theme'), + 'edit_item' => __('Editer le Type de projet', 'deligraph-theme'), + 'update_item' => __('Mettre à jour le Type de projet', 'deligraph-theme'), + 'add_new_item' => __('Ajouter un Type de projet', 'deligraph-theme'), + 'new_item_name' => __('Nom du nouveau Type de projet', 'deligraph-theme'), + 'menu_name' => __('Type de projet', 'deligraph-theme'), ), - 'show_admin_column' => true, - 'show_ui' => true, - 'query_var' => true, - 'rewrite' => array('slug' => 'customer'), - ) -); + 'public' => true, + 'show_in_rest' => true, + 'show_ui' => true, + 'show_admin_column' => false, + 'show_in_quick_edit' => false, + 'meta_box_cb' => false, + 'hierarchical' => false, + )); + + + register_taxonomy( + 'customer', /* Voici donc la taxonomie */ + array('customer'), /* nom du custom post type */ + array( + 'hierarchical' => true, + 'labels' => array( + 'name' => __('Catégories', 'customer'), + 'singular_name' => __('Catégories', 'nom du theme'), + 'search_items' => __('Rechercher une catégorie', 'nom du theme'), + 'all_items' => __('Toutes les catégories', 'nom du theme'), + 'parent_item' => __('Catégorie parente', 'nom du theme'), + 'parent_item_colon' => __('Catégorie parente :', 'nom du theme'), + 'edit_item' => __('Éditer une catégorie', 'nom du theme'), + 'update_item' => __('Sauvegarder une catégorie', 'nom du theme'), + 'add_new_item' => __('Ajouter une catégorie', 'nom du theme'), + 'new_item_name' => __('Nouvelle catégorie', 'nom du theme') + ), + 'show_admin_column' => true, + 'show_ui' => true, + 'query_var' => true, + 'rewrite' => array('slug' => 'customer'), + ) + ); +} +add_action('init', 'homegrade_add_custom_taxonomies', 0);