Advertisement
pskli

Tutoriel WordPress Cuztom #1 par Pierre Saikali

Mar 13th, 2013
717
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.05 KB | None | 0 0
  1. <?php
  2.  
  3. // Type de contenu Livre
  4.  
  5. $book = register_cuztom_post_type(
  6.     'Livre',
  7.     array(
  8.         'menu_icon' => get_template_directory_uri() . '/img/book.png'
  9.     )
  10. );
  11.  
  12. $book->add_taxonomy('Genre');
  13.  
  14. // Ajouter une metabox et plusieurs champs
  15.  
  16. $book->add_meta_box(
  17.     'book_info',
  18.     'Information sur ce livre',
  19.     array(
  20.         array(
  21.             'name' => 'publication_date',
  22.             'label' => 'Date de publication',
  23.             'type' => 'date',
  24.             'description' => 'Description qui va sous le titre',
  25.             'explanation' => 'Explication qui va sous le champs',
  26.         ),
  27.         array(
  28.             'name' => 'cover',
  29.             'label' => 'Couverture du livre',
  30.             'type' => 'image',
  31.             'description' => 'Envoyez une image de couverture du livre'
  32.         ),
  33.         array(
  34.             'type' => 'post_select',
  35.             'name' => 'author',
  36.             'label' => 'Auteur du livre',
  37.             'args' => array(
  38.                 'post_type' => 'author',
  39.                 'posts_per_page' => -1
  40.             )
  41.         )
  42.     )
  43. );
  44.  
  45. // Type de contenu Auteur
  46.  
  47. $author = register_cuztom_post_type(
  48.     'Auteur',
  49.     array(
  50.         'menu_icon' => get_template_directory_uri() . '/img/pencil.png'
  51.     )
  52. );
  53.  
  54.  
  55. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement