Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Departments Taxonomy

The Departments Taxonomy is used with the Team Members C.P.T. to define different departments in an organization.

if ( ! function_exists( 'mle_taxonomies' ) ) {

// Register Custom Taxonomy
function mle_taxonomies() {

	$labels = array(
		'name'                       => _x( 'Departments', 'Taxonomy General Name', 'mle_custom_post_types' ),
		'singular_name'              => _x( 'Department', 'Taxonomy Singular Name', 'mle_custom_post_types' ),
		'menu_name'                  => __( 'Departments', 'mle_custom_post_types' ),
		'all_items'                  => __( 'All Departments', 'mle_custom_post_types' ),
		'parent_item'                => __( 'Parent Department', 'mle_custom_post_types' ),
		'parent_item_colon'          => __( 'Parent Department:', 'mle_custom_post_types' ),
		'new_item_name'              => __( 'New Department Name', 'mle_custom_post_types' ),
		'add_new_item'               => __( 'Add New Department', 'mle_custom_post_types' ),
		'edit_item'                  => __( 'Edit Department', 'mle_custom_post_types' ),
		'update_item'                => __( 'Update Department', 'mle_custom_post_types' ),
		'view_item'                  => __( 'View Department', 'mle_custom_post_types' ),
		'separate_items_with_commas' => __( 'Separate Departments with commas', 'mle_custom_post_types' ),
		'add_or_remove_items'        => __( 'Add or remove items', 'mle_custom_post_types' ),
		'choose_from_most_used'      => __( 'Choose from the most used', 'mle_custom_post_types' ),
		'popular_items'              => __( 'Popular Departments', 'mle_custom_post_types' ),
		'search_items'               => __( 'Search Departments', 'mle_custom_post_types' ),
		'not_found'                  => __( 'Departments Not Found', 'mle_custom_post_types' ),
		'no_terms'                   => __( 'No Departments', 'mle_custom_post_types' ),
		'items_list'                 => __( 'Departments list', 'mle_custom_post_types' ),
		'items_list_navigation'      => __( 'Departments list navigation', 'mle_custom_post_types' ),
	);
	$args = array(
		'labels'                     => $labels,
		'hierarchical'               => true,
		'public'                     => true,
		'show_ui'                    => true,
		'show_admin_column'          => true,
		'show_in_nav_menus'          => true,
		'show_tagcloud'              => true,
	);
	register_taxonomy( 'departments', array( 'team_members' ), $args );

}
add_action( 'init', 'mle_taxonomies', 0 );

}