Advertisement
sscovil

Custom WP Taxonomy: Destinations

Oct 24th, 2011
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.12 KB | None | 0 0
  1. <?php
  2. //hook into the init action and call create_book_taxonomies when it fires
  3. add_action( 'init', 'create_destinations_taxonomy', 0 );
  4.  
  5. //create "destinations" taxonomy for the post type "post"
  6. function create_destinations_taxonomy()
  7. {
  8.   // Add new taxonomy, make it hierarchical (like categories)
  9.   $labels = array(
  10.     'name' => _x( 'Destinations', 'taxonomy general name' ),
  11.     'singular_name' => _x( 'Destination', 'taxonomy singular name' ),
  12.     'search_items' =>  __( 'Search Destinations' ),
  13.     'all_items' => __( 'All Destinations' ),
  14.     'parent_item' => __( 'Parent Destination' ),
  15.     'parent_item_colon' => __( 'Parent Destination:' ),
  16.     'edit_item' => __( 'Edit Destination' ),
  17.     'update_item' => __( 'Update Destination' ),
  18.     'add_new_item' => __( 'Add New Destination' ),
  19.     'new_item_name' => __( 'New Destination Name' ),
  20.     'menu_name' => __( 'Destinations' ),
  21.   );    
  22.  
  23.   register_taxonomy('destinations',array('post'), array(
  24.     'hierarchical' => true,
  25.     'labels' => $labels,
  26.     'show_ui' => true,
  27.     'query_var' => true,
  28.     'rewrite' => array( 'slug' => 'destinations' ),
  29.   ));
  30. }
  31. ?>
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement