Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

T2S – Documents

// Register Custom Post Type
function add_document_post_type() {

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

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