Advertisement
thesufi

Custom taxonomy demo

Apr 1st, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.51 KB | None | 0 0
  1. /*create color custom taxonomy for "event" custom post type. */
  2. function dct_tax_color() {
  3. $keyword = 'Color';
  4.     $taxslug = 'color';
  5.     $labels = array(
  6.         'name' => $keyword . 's',
  7.         'singular_name' => $keyword,
  8.         'add_new' => 'Add New',
  9.         'edit' => 'Edit',
  10.         'edit_item' => 'Edit ' . $keyword . 's',
  11.         'new_item' => 'New ' . $keyword . 's',
  12.         'all_items' => 'All ' . $keyword . 's',
  13.         'not_found' => 'No ' . $keyword . ' found',
  14.         'menu_name' => $keyword . 's',
  15.         'view_item' => 'View ' . $keyword,
  16.         'update_item' => 'Update ' . $keyword,
  17.         'add_new_item' => 'Add New ' . $keyword,
  18.         'new_item_name' => 'New ' . $keyword . ' Name',
  19.         'parent_item' => 'Parent ' . $keyword,
  20.         'parent_item_colon' => 'Parent ' . $keyword . ':',
  21.         'search_items' => 'Search ' . $keyword . 's',
  22.         'not_found' => 'No ' . $keyword . ' found.',
  23.     );
  24.  
  25.     $args = array(
  26.         'labels' => $labels,
  27.         'public' => true,
  28.         'has_archive' => true,
  29.         'rewrite' => array('slug' => $taxslug),
  30.         'exclude_from_search' => false,
  31.         'publicly_queryable' => true,
  32.         'show_ui' => true,
  33.         'map_meta_cap' => true,
  34.         'show_tagcloud' => false,
  35.         'show_admin_column' => true,
  36.         'description' => 'Sub sections of Money Posts',
  37.         'hierarchical' => true,
  38.         'sort' => true,
  39.     );
  40.  
  41.     register_taxonomy($taxslug, 'event', $args);
  42. }
  43.  
  44. add_action( 'init', 'dct_tax_color' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement