Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Coctail Essential Ingredients

Taxonomy for cocktail ingredients. This taxonomy is for a “cocktails” custom post type which also has a spirits tag taxonomy and a cocktail families category taxonomy.

if ( ! function_exists( 'cocktail_ingredients_taxonomy' ) ) {

// Register Custom Taxonomy
function cocktail_ingredients_taxonomy() {

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

}

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

}