Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Recipes

Recipe Post Type

// Register Custom Post Type
function CreatePostRecipe() {

	$labels = array(
		'name'                  => _x( 'Recipes', 'Post Type General Name', 'text_domain' ),
		'singular_name'         => _x( 'Recipe', 'Post Type Singular Name', 'text_domain' ),
		'menu_name'             => __( 'Recipes', 'text_domain' ),
		'name_admin_bar'        => __( 'Recipes', 'text_domain' ),
		'archives'              => __( 'Recipe Archives', 'text_domain' ),
		'attributes'            => __( 'Recipe Attributes', 'text_domain' ),
		'parent_item_colon'     => __( 'Parent Recipes', 'text_domain' ),
		'all_items'             => __( 'All Recipes', 'text_domain' ),
		'add_new_item'          => __( 'Create a Recipe', 'text_domain' ),
		'add_new'               => __( 'Create a Recipe', 'text_domain' ),
		'new_item'              => __( 'Create a Recipe', 'text_domain' ),
		'edit_item'             => __( 'Update this Kitchen Recipe', 'text_domain' ),
		'update_item'           => __( 'Update this Kitchen Recipe', 'text_domain' ),
		'view_item'             => __( 'View this Kitchen Recipe', 'text_domain' ),
		'view_items'            => __( 'View this Kitchen Recipes', 'text_domain' ),
		'search_items'          => __( 'Search Kitchen Recipes', 'text_domain' ),
		'not_found'             => __( 'This Kitchen Recipe Not found', 'text_domain' ),
		'not_found_in_trash'    => __( 'This Kitchen Recipe Not found in Trash', 'text_domain' ),
		'featured_image'        => __( 'Kitchen Recipe Featured Image', 'text_domain' ),
		'set_featured_image'    => __( 'Set Kitchen Recipe featured image', 'text_domain' ),
		'remove_featured_image' => __( 'Remove Kitchen Recipe featured image', 'text_domain' ),
		'use_featured_image'    => __( 'Use as Kitchen Recipe featured image', 'text_domain' ),
		'insert_into_item'      => __( 'Insert into Kitchen Recipe', 'text_domain' ),
		'uploaded_to_this_item' => __( 'Uploaded to this Kitchen Recipe', 'text_domain' ),
		'items_list'            => __( 'Kitchen Recipe list', 'text_domain' ),
		'items_list_navigation' => __( 'Kitchen Recipes list navigation', 'text_domain' ),
		'filter_items_list'     => __( 'Filter Kitchen Recipes list', 'text_domain' ),
	);
	$rewrite = array(
		'slug'                  => 'myrecipes',
		'with_front'            => true,
		'pages'                 => true,
		'feeds'                 => true,
	);
	$args = array(
		'label'                 => __( 'Recipe', 'text_domain' ),
		'description'           => __( 'Recipes found in the Kidney Community Kitchen', 'text_domain' ),
		'labels'                => $labels,
		'supports'              => array( 'title', 'editor', 'thumbnail', 'comments', 'custom-fields', 'page-attributes' ),
		'taxonomies'            => array( 'mealcategory', 'dietcategory' ),
		'hierarchical'          => false,
		'public'                => true,
		'show_ui'               => true,
		'show_in_menu'          => true,
		'menu_position'         => 5,
		'menu_icon'             => '_images/pan24.png',
		'show_in_admin_bar'     => true,
		'show_in_nav_menus'     => true,
		'can_export'            => true,
		'has_archive'           => 'archives/myrecipes',
		'exclude_from_search'   => false,
		'publicly_queryable'    => true,
		'rewrite'               => $rewrite,
		'capability_type'       => 'post',
		'show_in_rest'          => true,
	);
	register_post_type( 'myrecipes', $args );

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