Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. <ul>
  2. <?php $args = array('post_type' => 'formation');?>
  3. <?php $loop = new WP_Query($args);?>
  4. <?php while ($loop -> have_posts()): $loop->the_post();?>
  5. <li>
  6. <?php the_post_thumbnail('cpt_formation');?>
  7. <div class="container-other">
  8. <h4><?php the_title();?></h4>
  9. <p><?php the_content();?>
  10. </p>
  11. <a href="<?php the_field('url_formation');?>">En savoir plus</a>
  12. </div>
  13. </li>
  14. <?php endwhile;?>
  15. </ul>
  16.  
  17. function custom_formation(){
  18. $labels = array(
  19. 'name' => 'Formation',
  20. 'all_items' => 'Toutes les formations', // affiché dans le sous menu
  21. 'singular_name' => 'Formation',
  22. 'add_new_item' => 'Ajouter une formation',
  23. 'edit_item' => 'Modifier la formation',
  24. 'menu_name' => 'Formation'
  25. );
  26.  
  27. $args = array(
  28. 'labels' => $labels,
  29. 'public' => true,
  30. 'show_in_rest' => true,
  31. 'has_archive' => true,
  32. 'supports' => array( 'title', 'editor','thumbnail' ),
  33. 'menu_position' => 5,
  34. 'menu_icon' => 'dashicons-format-status',
  35. );
  36. register_post_type( 'formation', $args );
  37. enter register_taxonomy(
  38. 'thematique',
  39. 'formation',
  40. array(
  41. 'label' => 'Thématiques',
  42. 'labels' => array(
  43. 'name' => 'Thématiques',
  44. 'singular_name' => 'Thématiques',
  45. 'all_items' => 'Toutes les Thématiques',
  46. 'edit_item' => 'Éditer la Thématique',
  47. 'view_item' => 'Voir la Thématiques',
  48. 'update_item' => 'Mettre à jour la Thématiques',
  49. 'add_new_item' => 'Ajouter une Thématiques',
  50. 'new_item_name' => 'Nouvelle Thématiques',
  51. 'search_items' => 'Rechercher parmi les Thématiques',
  52. 'popular_items' => 'Thématiques les plus utilisés',
  53.  
  54. ),
  55. 'hierarchical' => true,
  56. 'show_in_rest' => true,
  57. 'rewrite'=>false,
  58. )
  59. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement