Posted By

jli on 11/13/10


Tagged

post wordpress type custom


Versions (?)

Wordpress CPT examples


 / Published in: PHP
 

  1. //CUSTOM POST TYPES DEFINITIONS
  2. add_action('init', 'cpt_activites_register', 1);
  3.  
  4. function cpt_activites_register() {
  5. $args = array(
  6. 'label' => __('Activités'),
  7. 'singular_label' => __('Activité'),
  8. '_builtin' => false,
  9. 'public' => true,
  10. 'show_ui' => true,
  11. 'capability_type' => 'post',
  12. 'hierarchical' => false,
  13. //'publicly_queryable' => false,
  14. //'exclude_from_search' => true,
  15. 'rewrite' => array("slug" => "activite"),
  16. 'supports' => array('title', 'editor', 'thumbnail')
  17. );
  18.  
  19. register_post_type( 'activite' , $args );
  20. }
  21.  
  22. add_action('init', 'cpt_restaurants_register', 1);
  23.  
  24. function cpt_restaurants_register() {
  25. $args = array(
  26. 'label' => __('Restaurants'),
  27. 'singular_label' => __('Restaurant'),
  28. '_builtin' => false,
  29. 'public' => true,
  30. 'show_ui' => true,
  31. 'capability_type' => 'post',
  32. 'hierarchical' => false,
  33. 'publicly_queryable' => false,
  34. 'exclude_from_search' => true,
  35. 'rewrite' => array("slug" => "restaurant"),
  36. 'supports' => array('title', 'editor', 'thumbnail')
  37. );
  38.  
  39. register_post_type( 'restaurant' , $args );
  40. }

Report this snippet  

You need to login to post a comment.