Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Spirits

tag taxonomy for cross referencing drinks by alcohol.

if ( ! function_exists( 'recipe_spirits_taxonomy' ) ) {

// Register Custom Taxonomy
function recipe_spirits_taxonomy() {

	$labels = array(
		'name'                       => _x( 'Spirits', 'Taxonomy General Name', 'gustologist' ),
		'singular_name'              => _x( 'Spirit', 'Taxonomy Singular Name', 'gustologist' ),
		'menu_name'                  => __( 'Spirits', 'gustologist' ),
		'all_items'                  => __( 'All Spirits', 'gustologist' ),
		'parent_item'                => __( 'Parent Spirit', 'gustologist' ),
		'parent_item_colon'          => __( 'Parent Spirit:', 'gustologist' ),
		'new_item_name'              => __( 'New Spirit', 'gustologist' ),
		'add_new_item'               => __( 'Add Spirit', 'gustologist' ),
		'edit_item'                  => __( 'Edit Spirit', 'gustologist' ),
		'update_item'                => __( 'Update Spirit', 'gustologist' ),
		'view_item'                  => __( 'View Spirit', 'gustologist' ),
		'separate_items_with_commas' => __( 'Separate spirits with commas', 'gustologist' ),
		'add_or_remove_items'        => __( 'Add or remove spirits', 'gustologist' ),
		'choose_from_most_used'      => __( 'Choose from the most used spirits', 'gustologist' ),
		'popular_items'              => __( 'Popular Spirits', 'gustologist' ),
		'search_items'               => __( 'Search Spirits', 'gustologist' ),
		'not_found'                  => __( 'Spirits Not Found', 'gustologist' ),
	);
	$rewrite = array(
		'slug'                       => 'spirits',
		'with_front'                 => true,
		'hierarchical'               => false,
	);
	$args = array(
		'labels'                     => $labels,
		'hierarchical'               => false,
		'public'                     => true,
		'show_ui'                    => true,
		'show_admin_column'          => false,
		'show_in_nav_menus'          => true,
		'show_tagcloud'              => true,
		'query_var'                  => 'spirits',
		'rewrite'                    => $rewrite,
	);
	register_taxonomy( 'ct_spirits', array( 'cocktails' ), $args );

}

// Hook into the 'init' action
add_action( 'init', 'recipe_spirits_taxonomy', 0 );

}