diff --git a/mu-plugins/carhop-post-types.php b/mu-plugins/carhop-post-types.php new file mode 100644 index 0000000..75d3a79 --- /dev/null +++ b/mu-plugins/carhop-post-types.php @@ -0,0 +1,71 @@ + array( + 'name' => __('DBMOB'), + 'singular_name' => __('DBMOB') + ), + 'public' => true, + 'has_archive' => true, + 'rewrite' => array('slug' => 'dictionnaire'), + 'show_in_rest' => true, + 'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode(''), + 'menu_position' => 5, + 'supports' => array('title', 'custom-fields'), + 'taxonomies' => array('category'), + ) + ); +} +add_action('init', 'carhop_create_posttype'); + + +/* ------------------------------------------------ + ##### CHANGE LE NOM DES POSTS PAR ACTUALITES + --------------------------------------------------*/ +function carhop_change_post_object() +{ + $current_site = get_current_blog_id(); + if ($current_site !== 1) return; + + $get_post_type = get_post_type_object('post'); + $labels = $get_post_type->labels; + $labels->name = 'Actualités'; + $labels->singular_name = 'Actualité'; + $labels->add_new = 'Ajouter une actualité'; + $labels->add_new_item = 'Ajouter une nouvelle actualité'; + $labels->edit_item = 'Editer l\'actualité'; + $labels->new_item = 'Actualité'; + $labels->view_item = 'Voir l\'actualité'; + $labels->search_items = 'Chercher une actualité'; + $labels->not_found = 'Pas d\'actualité trouvée'; + $labels->not_found_in_trash = 'Pas d\'actualité trouvée dans la corbeille'; + $labels->all_items = 'Toutes les actualités'; + $labels->menu_name = 'Actualités'; + $labels->name_admin_bar = 'Actualités'; + + // remove_post_type_support('post', 'editor'); + unregister_taxonomy_for_object_type('category', 'post'); + unregister_taxonomy_for_object_type('post_tag', 'post'); +} + +add_action('init', 'carhop_change_post_object'); diff --git a/mu-plugins/dynamiques-post-types.php b/mu-plugins/dynamiques-post-types.php new file mode 100644 index 0000000..e31f8f4 --- /dev/null +++ b/mu-plugins/dynamiques-post-types.php @@ -0,0 +1,82 @@ + array( + 'name' => __('Revues'), + 'singular_name' => __('Revue') + ), + 'public' => true, + 'has_archive' => true, + 'show_in_rest' => true, + 'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode(''), + 'menu_position' => 4, + 'supports' => array( + 'title', + 'thumbnail', + 'excerpt', + 'custom-fields', + 'revisions', + 'author', + ), + + ) + ); + register_post_type( + 'articles', + // CPT Options + array( + 'labels' => array( + 'name' => __('Articles'), + 'singular_name' => __('Articles') + ), + 'public' => true, + 'has_archive' => true, + 'show_in_rest' => true, + 'menu_icon' => 'dashicons-edit-page', + 'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode(''), + 'menu_position' => 4, + 'supports' => array( + 'title', + 'editor', + 'thumbnail', + 'excerpt', + 'custom-fields', + 'revisions', + 'author', + ), + ) + ); +} +add_action('init', 'dynamiques_create_posttype'); +/* ---------------------------------------------------------------- + ##### REMOVE FROM ADMIN MENU + ------------------------------------------------------------------*/ +function dynamiques_custom_menu_page_removing() +{ + + $current_site = get_current_blog_id(); + if ($current_site !== 2) return; + + remove_menu_page('edit.php'); // Hide Articles + remove_menu_page('edit-comments.php'); // Hide Commentaires +} +add_action('admin_menu', 'dynamiques_custom_menu_page_removing'); diff --git a/mu-plugins/dynamiques-articles.php b/mu-plugins/dynamiques-taxonomies.php similarity index 94% rename from mu-plugins/dynamiques-articles.php rename to mu-plugins/dynamiques-taxonomies.php index 5001188..8739022 100644 --- a/mu-plugins/dynamiques-articles.php +++ b/mu-plugins/dynamiques-taxonomies.php @@ -1,9 +1,9 @@