Wordpress - Create custom taxonomies


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function create_theme_taxonomy() {
  2.  
  3.  
  4. register_taxonomy('ville-activite', array('activite'), array(
  5. 'hierarchical' => TRUE,
  6. 'label' => 'Villes - Activités',
  7. 'singular_label' => 'Ville - Activités',
  8. 'public' => TRUE,
  9. 'show_ui' => TRUE,
  10. 'show_tagcloud' => FALSE,
  11. 'rewrite' => FALSE
  12. ));
  13.  
  14. register_taxonomy('ville-restaurant', array('restaurant'), array(
  15. 'hierarchical' => TRUE,
  16. 'label' => 'Villes - Restaurants',
  17. 'singular_label' => 'Ville - Restaurants',
  18. 'public' => TRUE,
  19. 'show_ui' => TRUE,
  20. 'show_tagcloud' => FALSE,
  21. 'rewrite' => FALSE
  22. ));
  23.  
  24. register_taxonomy('ville', array('activite','restaurant'), array(
  25. 'hierarchical' => TRUE,
  26. 'label' => 'Villes',
  27. 'singular_label' => 'Ville',
  28. 'public' => TRUE,
  29. 'show_ui' => TRUE,
  30. 'show_tagcloud' => FALSE,
  31. 'rewrite' => FALSE
  32. ));
  33.  
  34. }
  35. add_action( 'init', 'create_theme_taxonomy', 0 );

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.