Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

CT Habitats

Companion to Fish Types CPT

if ( ! function_exists( 'CT_habitats' ) ) {

// Register Custom Taxonomy
function CT_habitats() {

	$labels = array(
		'name'                       => _x( 'Habitats', 'Taxonomy General Name', 'showcase' ),
		'singular_name'              => _x( 'Habitat', 'Taxonomy Singular Name', 'showcase' ),
		'menu_name'                  => __( 'Habitat', 'showcase' ),
		'all_items'                  => __( 'All Habitats', 'showcase' ),
		'parent_item'                => __( 'Parent Habitat', 'showcase' ),
		'parent_item_colon'          => __( 'Parent Habitat:', 'showcase' ),
		'new_item_name'              => __( 'New Habitat Name', 'showcase' ),
		'add_new_item'               => __( 'Add New Habitat', 'showcase' ),
		'edit_item'                  => __( 'Edit Habitat', 'showcase' ),
		'update_item'                => __( 'Update Habitat', 'showcase' ),
		'view_item'                  => __( 'View Habitat', 'showcase' ),
		'separate_items_with_commas' => __( 'Separate habitats with commas', 'showcase' ),
		'add_or_remove_items'        => __( 'Add or remove habitats', 'showcase' ),
		'choose_from_most_used'      => __( 'Choose from the most used', 'showcase' ),
		'popular_items'              => __( 'Popular Habitats', 'showcase' ),
		'search_items'               => __( 'Search Habitats', 'showcase' ),
		'not_found'                  => __( 'Not Found', 'showcase' ),
		'no_terms'                   => __( 'No habitats', 'showcase' ),
		'items_list'                 => __( 'Habitats list', 'showcase' ),
		'items_list_navigation'      => __( 'Habitats list navigation', 'showcase' ),
	);
	$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( 'habitat', array( 'fish_type' ), $args );

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

}