Advertisement
jpscoggan

Custom Taxonomy for The Event Calendar Events

Apr 21st, 2014
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.20 KB | None | 0 0
  1. /* create a custom taxonomy 'Custom Tags' for events in The Event Calendar Pro - I created a custom plugin for this code, but can be in functions.php */
  2.  
  3. function create_custom_tags_taxonomy() {
  4.  
  5.     // Add new taxonomy, make it hierarchical like categories
  6.     //first do the translations part for GUI
  7.  
  8.     $labels = array(
  9.         'name' => _x( 'Custom Tags', 'taxonomy general name' ),
  10.         'singular_name' => _x( 'Custom Tag', 'taxonomy singular name' ),
  11.         'search_items' =>  __( 'Search Custom Tags' ),
  12.         'all_items' => __( 'All Custom Tags' ),
  13.         'parent_item' => __( 'Parent Custom Tag' ),
  14.         'parent_item_colon' => __( 'Parent Custom Tag:' ),
  15.         'edit_item' => __( 'Edit Custom Tag' ),
  16.         'update_item' => __( 'Update Custom Tag' ),
  17.         'add_new_item' => __( 'Add New Custom Tag' ),
  18.         'new_item_name' => __( 'New Custom Tag Name' ),
  19.         'menu_name' => __( 'Custom Tags' ),
  20.     );  
  21.  
  22.     // Register the taxonomy and associate it with 'tribe_events' post type
  23.     register_taxonomy('custom_tags',array('tribe_events'), array(
  24.         'hierarchical' => true,
  25.         'labels' => $labels,
  26.         'show_ui' => true,
  27.         'show_admin_column' => true,
  28.         'query_var' => true,
  29.         'rewrite' => array( 'slug' => 'custom-tags' ),
  30.         'sort' => true,
  31.     ));
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement