Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Media post type

// Register Custom Post Type
function custom_post_type_media() {

	$labels = array(
		'name'                  => _x( 'Media', 'Post Type General Name', 'yt' ),
		'singular_name'         => _x( 'Media', 'Post Type Singular Name', 'yt' ),
		'menu_name'             => __( 'Media', 'yt' ),
		'name_admin_bar'        => __( 'Media', 'yt' ),
		'archives'              => __( 'Item Archives', 'yt' ),
		'parent_item_colon'     => __( 'Parent Media:', 'yt' ),
		'all_items'             => __( 'All Media', 'yt' ),
		'add_new_item'          => __( 'Add New Media', 'yt' ),
		'add_new'               => __( 'Add New', 'yt' ),
		'new_item'              => __( 'New Media', 'yt' ),
		'edit_item'             => __( 'Edit Media', 'yt' ),
		'update_item'           => __( 'Update Media', 'yt' ),
		'view_item'             => __( 'View Media', 'yt' ),
		'search_items'          => __( 'Search Media', 'yt' ),
		'not_found'             => __( 'Not found', 'yt' ),
		'not_found_in_trash'    => __( 'Not found in Trash', 'yt' ),
		'featured_image'        => __( 'Featured Image', 'yt' ),
		'set_featured_image'    => __( 'Set featured image', 'yt' ),
		'remove_featured_image' => __( 'Remove featured image', 'yt' ),
		'use_featured_image'    => __( 'Use as featured image', 'yt' ),
		'insert_into_item'      => __( 'Insert into media', 'yt' ),
		'uploaded_to_this_item' => __( 'Uploaded to this media', 'yt' ),
		'items_list'            => __( 'Media list', 'yt' ),
		'items_list_navigation' => __( 'Media list navigation', 'yt' ),
		'filter_items_list'     => __( 'Filter media list', 'yt' ),
	);
	$args = array(
		'label'                 => __( 'Media', 'yt' ),
		'labels'                => $labels,
		'supports'              => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'trackbacks', 'revisions', 'page-attributes', 'post-formats', ),
		'taxonomies'            => array( 'category', 'post_tag' ),
		'hierarchical'          => false,
		'public'                => true,
		'show_ui'               => true,
		'show_in_menu'          => true,
		'menu_position'         => 5,
		'menu_icon'             => 'dashicons-media-document',
		'show_in_admin_bar'     => true,
		'show_in_nav_menus'     => true,
		'can_export'            => true,
		'has_archive'           => true,		
		'exclude_from_search'   => false,
		'publicly_queryable'    => true,
		'capability_type'       => 'post',
	);
	register_post_type( 'media', $args );

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