diff --git a/mu-plugins/carhop-post-types.php b/mu-plugins/carhop-post-types.php
index eb59df9..2b48475 100644
--- a/mu-plugins/carhop-post-types.php
+++ b/mu-plugins/carhop-post-types.php
@@ -17,10 +17,9 @@ function carhop_create_posttype()
$current_site = get_current_blog_id();
if ($current_site !== 1) return;
-
+ // -------EQUIPE------- //
register_post_type(
'equipe',
- // CPT Options
array(
'labels' => array(
'name' => __('Equipe'),
@@ -39,11 +38,14 @@ function carhop_create_posttype()
'has_archive' => true,
'rewrite' => array('slug' => 'equipe-carhop'),
'show_in_rest' => true,
- 'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode(''),
- 'menu_position' => 5,
+ 'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode(''),
+ 'menu_position' => 4,
'supports' => array('title', 'custom-fields'),
)
);
+
+ // -------DBMOB------- //
+
register_post_type(
'dbmob',
// CPT Options
@@ -56,12 +58,15 @@ function carhop_create_posttype()
'has_archive' => true,
'rewrite' => array('slug' => 'dictionnaire'),
'show_in_rest' => true,
- 'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode(''),
- 'menu_position' => 5,
+ 'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode(''),
+ 'menu_position' => 4,
'supports' => array('title', 'custom-fields'),
'taxonomies' => array('category'),
)
);
+
+ // -------ANALYSES ET ETUDES------- //
+
register_post_type(
'analyses-etudes',
// CPT Options
@@ -75,15 +80,28 @@ function carhop_create_posttype()
'has_archive' => true,
'rewrite' => array('slug' => 'analyses-etudes'),
'show_in_rest' => true,
- 'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode(''),
- // 'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode(''),
- 'menu_position' => 5,
+ 'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode(string: ''),
+ 'menu_position' => 4,
'supports' => array('title', 'custom-fields'),
- 'taxonomies' => array('category'),
+ 'taxonomies' => array('type'),
)
);
-
- // Communiqué de presse — affiché sous le menu « Presse » (parent créé dans le thème)
+ register_post_type(
+ 'recherches',
+ // CPT Options
+ array(
+ 'labels' => array(
+ 'name' => __('Recherches'),
+ 'singular_name' => __('Recherche'),
+ ),
+ 'menu_name' => 'Recherches participatives',
+ 'public' => true,
+ 'has_archive' => true,
+ 'menu_position' => 4,
+ )
+ );
+ // -------COMMUNIQUÉS DE PRESSE ------- //
+ // affiché sous le menu « Presse » (parent créé dans le thème)
register_post_type(
'communique-presse',
array(
@@ -107,12 +125,99 @@ function carhop_create_posttype()
'show_in_rest' => true,
'show_in_menu' => 'carhop-presse',
'supports' => array('title', 'custom-fields'),
+ 'menu_position' => 4,
+ )
+ );
+
+
+
+
+ // -------EXPOSITIONS------- //
+ register_post_type(
+ 'expositions',
+ array(
+ 'labels' => array(
+ 'name' => __('Expositions'),
+ 'singular_name' => __('Exposition'),
+ ),
+ 'public' => true,
+ 'has_archive' => true,
+ 'rewrite' => array('slug' => 'expositions'),
+ 'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode(string: ''),
+ 'show_in_rest' => true,
+ 'supports' => array('title', 'custom-fields', 'editor'),
+ 'menu_position' => 4,
+ )
+ );
+
+ // -------EXPOSITIONS------- //
+ register_post_type(
+ 'outils-pedagogiques',
+ array(
+ 'labels' => array(
+ 'name' => __('Outils pédagogiques'),
+ 'singular_name' => __('Outil pédagogique'),
+ ),
+ 'public' => true,
+ 'has_archive' => true,
+ 'rewrite' => array('slug' => 'outils-pedagogiques'),
+ 'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode(string: ''),
+ 'show_in_rest' => true,
+ 'supports' => array('title', 'custom-fields', 'editor'),
+ 'menu_position' => 4,
)
);
}
add_action('init', 'carhop_create_posttype');
+/* ------------------------------------------------
+ ##### TAXONOMIES
+--------------------------------------------------*/
+function carhop_register_taxonomies()
+{
+ $current_site = get_current_blog_id();
+ if ($current_site !== 1) return;
+
+ // Taxonomie "Type" pour Analyses & Études
+ $labels = array(
+ 'name' => _x('Types de publication', 'Taxonomy General Name', 'carhop-post-types'),
+ 'singular_name' => _x('Type de publication', 'Taxonomy Singular Name', 'carhop-post-types'),
+ 'menu_name' => __('Types', 'carhop-post-types'),
+ 'all_items' => __('Tous les types', 'carhop-post-types'),
+ 'parent_item' => __('Type parent', 'carhop-post-types'),
+ 'parent_item_colon' => __('Type parent:', 'carhop-post-types'),
+ 'new_item_name' => __('Nouveau type', 'carhop-post-types'),
+ 'add_new_item' => __('Ajouter un type', 'carhop-post-types'),
+ 'edit_item' => __('Modifier le type', 'carhop-post-types'),
+ 'update_item' => __('Mettre à jour le type', 'carhop-post-types'),
+ 'view_item' => __('Voir le type', 'carhop-post-types'),
+ 'separate_items_with_commas' => __('Séparer les types avec des virgules', 'carhop-post-types'),
+ 'add_or_remove_items' => __('Ajouter ou supprimer des types', 'carhop-post-types'),
+ 'choose_from_most_used' => __('Choisir parmi les plus utilisés', 'carhop-post-types'),
+ 'popular_items' => __('Types populaires', 'carhop-post-types'),
+ 'search_items' => __('Rechercher des types', 'carhop-post-types'),
+ 'not_found' => __('Non trouvé', 'carhop-post-types'),
+ 'no_terms' => __('Aucun type', 'carhop-post-types'),
+ 'items_list' => __('Liste des types', 'carhop-post-types'),
+ 'items_list_navigation' => __('Navigation dans la liste des types', 'carhop-post-types'),
+ );
+ $args = array(
+ 'labels' => $labels,
+ 'hierarchical' => true, // true pour catégories (hiérarchique), false pour tags
+ 'public' => true,
+ 'show_ui' => true,
+ 'show_admin_column' => true,
+ 'show_in_nav_menus' => true,
+ 'show_tagcloud' => true,
+ 'show_in_rest' => true, // Important pour l'éditeur Gutenberg
+ 'rewrite' => array('slug' => 'type'),
+ );
+ register_taxonomy('type', array('analyses-etudes'), $args);
+}
+add_action('init', 'carhop_register_taxonomies', 0);
+
+
/* ------------------------------------------------
##### CHANGE LE NOM DES POSTS PAR ACTUALITES
--------------------------------------------------*/
diff --git a/mu-plugins/shared-post-types.php b/mu-plugins/shared-post-types.php
new file mode 100644
index 0000000..3bc95e3
--- /dev/null
+++ b/mu-plugins/shared-post-types.php
@@ -0,0 +1,49 @@
+ array(
+ 'name' => __('Auteurs'),
+ 'singular_name' => __('Auteur'),
+ 'add_new' => __('Ajouter un auteur'),
+ 'add_new_item' => __('Ajouter un auteur'),
+ 'edit_item' => __('Editer l\'auteur'),
+ 'new_item' => __('Nouvel auteur'),
+ 'view_item' => __('Voir l\'auteur'),
+ 'search_items' => __('Chercher un auteur'),
+ 'not_found' => __('Pas d\'auteur trouvé'),
+ 'not_found_in_trash' => __('Pas d\'auteur trouvé dans la corbeille'),
+ 'all_items' => __('Tous les auteurs'),
+ 'menu_name' => __('Auteurs'),
+ 'name_admin_bar' => __('Auteurs'),
+ ),
+ 'public' => true,
+ 'has_archive' => true,
+ 'show_in_rest' => true,
+ 'menu_icon' => 'dashicons-admin-users',
+ 'menu_position' => 4,
+ 'supports' => array(
+ 'title',
+ 'thumbnail',
+ 'custom-fields',
+ 'revisions',
+ ),
+ )
+ );
+}
+add_action('init', 'shared_create_posttype');
+
+