diff --git a/includes/post_types.php b/includes/post_types.php index 944c6ae..2bd7116 100644 --- a/includes/post_types.php +++ b/includes/post_types.php @@ -1,29 +1,72 @@ - array( - 'name' => __( 'Scientific Publications' ), - 'singular_name' => __( 'Publication' ) - ), - 'public' => true, - 'has_archive' => true, - 'rewrite' => array('slug' => 'example'), - 'show_in_rest' => true, - 'menu_icon' => 'dashicons-analytics', - 'menu_position' => 4, - 'supports' => array ( 'title', 'custom-fields' ), - - - ) + register_post_type( + 'publications', + // CPT Options + array( + 'labels' => array( + 'name' => __('Publications'), + 'singular_name' => __('Publication') + ), + 'public' => true, + 'has_archive' => true, + 'show_in_rest' => true, + 'menu_icon' => 'dashicons-analytics', + 'menu_position' => 4, + 'supports' => array('title', 'custom-fields'), + ) + ); + register_post_type( + 'dbmob', + // CPT Options + array( + 'labels' => 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'), + ) ); - - } -add_action( 'init', 'create_posttype' ); \ No newline at end of file +add_action('init', 'create_posttype'); + + +/* ------------------------------------------------ + ##### CHANGE LE NOM DES POSTS PAR ACTUALITES + --------------------------------------------------*/ +function deligraph_theme_change_post_object() +{ + $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', 'deligraph_theme_change_post_object');