
<center><h2><strong>Ubuntu</strong></h2>
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
<!DOCTYPE html>
<html>
<?php

/**
* Plugin Name: Custom Post Réalisations
* Description: Ajoute l'onglet réalisations au wordpress.
* Author: Kevin Chauvet
* Version: 1.0
*/

function add_cpt_realisations_taxonomy() {
 
    $labels = array(
      'name' => _x( 'Type de travaux', 'taxonomy general name' ),
      'singular_name' => _x( 'Type de travail', 'taxonomy singular name' ),
      'search_items' =>  __( 'Chercher' ),
      'all_items' => __( 'Tous les types de travaux' ),
      'parent_item' => __( 'Type de travail parent' ),
      'parent_item_colon' => __( 'Type de travail parent :' ),
      'edit_item' => __( 'Editer le type de travail' ), 
      'update_item' => __( 'Mettre à jour le type de travail' ),
      'add_new_item' => __( 'Ajouter un type de travail' ),
      'new_item_name' => __( 'Nouveau type de travail' ),
      'menu_name' => __( 'Type de travail' ),
    ); 	
   
    register_taxonomy('type_de_travaux',array('realisations'), array(
      'hierarchical' => true,
      'labels' => $labels,
      'show_ui' => true,
      'show_admin_column' => true,
      'query_var' => true,
      'rewrite' => array( 'slug' => 'type/* _ */de-travaux' ),
    ));
  }
  
  add_action( 'init', 'add_cpt_realisations_taxonomy', 0 );
 
function add_cpt_realisations() {
    $labels = array(
        'name'                => _x( 'Réalisations', 'Post Type General Name' ),
        'singular_name'       => _x( 'Réalisation', 'Post Type Singular Name' ),
        'menu_name'           => __( 'Réalisations' ),
        'parent_item_colon'   => __( 'Parent Réalisations' ),
        'all_items'           => __( 'Toutes les réalisations' ),
        'view_item'           => __( 'Voir la réalisation' ),
        'add_new_item'        => __( 'Ajouter une nouvelle réalisation' ),
        'add_new'             => __( 'Nouvelle réalisation' ),
        'edit_item'           => __( 'Modifier la réalisation' ),
        'update_item'         => __( 'Mettre à jour' ),
        'search_items'        => __( 'Chercher' ),
        'not_found'           => __( 'Introuvable' ),
        'not_found_in_trash'  => __( 'Introuvable dans la corbeille' ),
    );
     
    $args = array(
        'label'               => __( 'realisations' ),
        'labels'              => $labels,
        'description'         => __( 'Nos réalisations.' ),        
        'capability_type'     => 'post',
        'taxonomies'          => array( 'realisations' ),
        'supports'            => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'revisions', ),
        'show_in_rest'        => true,        
        'hierarchical'        => false,
        'public'              => true,
        'show_ui'             => true,
        'show_in_menu'        => true,
        'show_in_nav_menus'   => true,
        'show_in_admin_bar'   => true,
        'menu_position'       => 4,
        'menu_icon'           => 'dashicons-carrot',
        'can_export'          => true,
        'has_archive'         => true,
        'exclude_from_search' => false,
        'publicly_queryable'  => true,
        
        'rewrite'             => array('slug' => 'realisations'),
    );

    register_post_type( 'realisations', $args );
};

add_action( 'init', 'add_cpt_realisations');

?>