Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.03 KB | None | 0 0
  1. <?php
  2. add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
  3. function my_theme_enqueue_styles() {
  4.  
  5. $parent_style = 'parent-style';
  6.  
  7. wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
  8. wp_enqueue_style( 'child-style',
  9. get_stylesheet_directory_uri() . '/style.css',
  10. array( $parent_style ),
  11. wp_get_theme()->get('Version')
  12. );
  13. }
  14.  
  15. function wpm_custom_post_type() {
  16. $labels = array(
  17. 'name' => 'Réalisations',
  18. 'singular_name' => 'Réalisation',
  19. 'menu_name' => 'Réalisations',
  20. 'all_items' => __( 'Toutes les réalisations'),
  21. 'view_item' => __( 'Voir les réalisations'),
  22. 'add_new_item' => __( 'Ajouter une nouvelle réalisation'),
  23. 'add_new' => __( 'Ajouter'),
  24. 'edit_item' => __( 'Editer la réalisation'),
  25. 'update_item' => __( 'Modifier la réalisation'),
  26. 'search_items' => __( 'Rechercher une réalisation'),
  27. 'not_found' => __( 'Non trouvée'),
  28. 'not_found_in_trash' => __( 'Non trouvée dans la corbeille')
  29. );
  30.  
  31. $args = array(
  32. 'labels' => $labels,
  33. 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt'),
  34. 'hierarchical' => false,
  35. 'public' => true,
  36. 'has_archive' => true,
  37. 'rewrite' => array( 'slug' => 'nos-realisations')
  38. );
  39.  
  40. register_post_type( 'realisations', $args );
  41. }
  42.  
  43. add_action( 'init', 'wpm_custom_post_type', 0 );
  44.  
  45. function add_realisations_taxonomies() {
  46. $labels_types = array(
  47. 'name' => 'Types',
  48. 'singular_name' => 'Type',
  49. 'search_items' => 'Rechercher',
  50. 'all_items' => 'Tous les types',
  51. 'edit_item' => 'Modifier',
  52. 'update_item' => 'Mettre à jour',
  53. 'add_new_item' => 'Ajouter un type',
  54. 'new_item_name' => 'Nouveau type',
  55. 'menu_name' => 'Types',
  56. );
  57.  
  58. $args_types = array(
  59. 'hierarchical' => true,
  60. 'labels' => $labels_types,
  61. 'show_ui' => true,
  62. 'show_admin_column' => true,
  63. 'query_var' => true,
  64. 'rewrite' => array( 'slug' => 'nos-types' ),
  65. );
  66.  
  67. register_taxonomy( 'types', array( 'realisations' ), $args_types );
  68. }
  69.  
  70. add_action( 'init', 'add_realisations_taxonomies', 0 );
  71.  
  72. add_action( 'init', 'produits' );
  73.  
  74. function produits() {
  75. $labels_produits = array(
  76. 'name' => 'Produits',
  77. 'singular_name' => "Produit",
  78. 'menu_name' => "Mes produits",
  79. 'name_admin_bar' => "Produits",
  80. 'add_new' => "Ajouter",
  81. 'add_new_item' => "Ajouter un nouveau produit",
  82. 'new_item' => "Nouveau produit",
  83. 'edit_item' => "Modifier",
  84. 'view_item' => "Voir",
  85. 'all_items' => "Tous les produits",
  86. 'search_items' => "Rechercher",
  87. 'not_found' => "Non trouvé",
  88. 'not_found_in_trash' => "Non trouvé dans la corbeille"
  89. );
  90.  
  91. $args_produits = array(
  92. 'labels' => $labels_produits,
  93. 'description' => __( 'Description.', 'your-plugin-textdomain' ),
  94. 'public' => true,
  95. 'publicly_queryable' => true,
  96. 'show_ui' => true,
  97. 'show_in_menu' => true,
  98. 'query_var' => true,
  99. 'rewrite' => array( 'slug' => 'nos-produits' ),
  100. 'capability_type' => 'post',
  101. 'has_archive' => true,
  102. 'hierarchical' => false,
  103. 'menu_position' => null,
  104. 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
  105. );
  106.  
  107. register_post_type( 'produits', $args_produits );
  108. }
  109.  
  110. add_action( 'init', 'rayons', 0 );
  111. function rayons() {
  112. // Add new taxonomy, make it hierarchical (like categories)
  113. $labels_rayons = array(
  114. 'name' => 'Rayons',
  115. 'singular_name' => 'Rayon',
  116. 'search_items' => 'Rechercher les rayons',
  117. 'all_items' => 'Tous les rayons',
  118. 'parent_item' => 'Rayons',
  119. 'edit_item' => 'Modifier',
  120. 'update_item' => 'Mise à jour des rayons',
  121. 'add_new_item' => 'Ajouter un nouveau rayon',
  122. 'new_item_name' => 'Nouveau rayon',
  123. 'menu_name' => 'Rayons'
  124. );
  125.  
  126. $args_rayons = array(
  127. 'hierarchical' => true,
  128. 'labels' => $labels_rayons,
  129. 'show_ui' => true,
  130. 'show_admin_column' => true,
  131. 'query_var' => true,
  132. 'rewrite' => array( 'slug' => 'nos-rayons' ),
  133. );
  134.  
  135. register_taxonomy( 'rayons', array( 'produits' ), $args_rayons );
  136.  
  137. }
  138.  
  139. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement