Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Cocktail Families

A custom taxonomy for a drink recipe taxonomy for categorizing beverages.

if ( ! function_exists( 'cocktail_families_taxonomy' ) ) {

// Register Custom Taxonomy
function cocktail_families_taxonomy() {

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

}

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

}