Skip to content

Instantly share code, notes, and snippets.

@wpspeak
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpspeak/8882615 to your computer and use it in GitHub Desktop.
Save wpspeak/8882615 to your computer and use it in GitHub Desktop.
Create A 'Type' Custom Taxonomy
<?php
add_action( 'init', 'afn_register_taxonomy_types' );
function afn_register_taxonomy_types() {
$labels = array(
'name' => _x( 'Types', 'types' ),
'singular_name' => _x( 'Type', 'types' ),
'search_items' => _x( 'Search Types', 'types' ),
'popular_items' => _x( 'Popular Types', 'types' ),
'all_items' => _x( 'All Types', 'types' ),
'parent_item' => _x( 'Parent Type', 'types' ),
'parent_item_colon' => _x( 'Parent Type:', 'types' ),
'edit_item' => _x( 'Edit Type', 'types' ),
'update_item' => _x( 'Update Type', 'types' ),
'add_new_item' => _x( 'Add New Type', 'types' ),
'new_item_name' => _x( 'New Type', 'types' ),
'separate_items_with_commas' => _x( 'Separate types with commas', 'types' ),
'add_or_remove_items' => _x( 'Add or remove types', 'types' ),
'choose_from_most_used' => _x( 'Choose from the most used types', 'types' ),
'menu_name' => _x( 'Types', 'types' ),
);
$args = array(
'labels' => $labels,
'public' => true,
'show_in_nav_menus' => true,
'show_ui' => true,
'show_tagcloud' => true,
'show_admin_column' => false,
'hierarchical' => true,
'rewrite' => true,
'query_var' => true
);
register_taxonomy( 'types', array('Portfolio'), $args );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment