Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Tools CPT

if ( ! function_exists('wf_cpt_tools') ) {

// Register Custom Post Type
function wf_cpt_tools() {

	$labels = array(
		'name'                  => _x( 'Tools', 'Post Type General Name', 'bb-theme-child' ),
		'singular_name'         => _x( 'Tool', 'Post Type Singular Name', 'bb-theme-child' ),
		'menu_name'             => __( 'Tools', 'bb-theme-child' ),
		'name_admin_bar'        => __( 'Tool', 'bb-theme-child' ),
		'archives'              => __( 'Tool Archives', 'bb-theme-child' ),
		'attributes'            => __( 'Tool Attributes', 'bb-theme-child' ),
		'parent_item_colon'     => __( 'Parent Tool:', 'bb-theme-child' ),
		'all_items'             => __( 'All Tools', 'bb-theme-child' ),
		'add_new_item'          => __( 'Add New Tool', 'bb-theme-child' ),
		'add_new'               => __( 'Add New', 'bb-theme-child' ),
		'new_item'              => __( 'New Tool', 'bb-theme-child' ),
		'edit_item'             => __( 'Edit Tool', 'bb-theme-child' ),
		'update_item'           => __( 'Update Tool', 'bb-theme-child' ),
		'view_item'             => __( 'View Tool', 'bb-theme-child' ),
		'view_items'            => __( 'View Tools', 'bb-theme-child' ),
		'search_items'          => __( 'Search Tool', 'bb-theme-child' ),
		'not_found'             => __( 'Not found', 'bb-theme-child' ),
		'not_found_in_trash'    => __( 'Not found in Trash', 'bb-theme-child' ),
		'featured_image'        => __( 'Featured Image', 'bb-theme-child' ),
		'set_featured_image'    => __( 'Set featured image', 'bb-theme-child' ),
		'remove_featured_image' => __( 'Remove featured image', 'bb-theme-child' ),
		'use_featured_image'    => __( 'Use as featured image', 'bb-theme-child' ),
		'insert_into_item'      => __( 'Insert into tool', 'bb-theme-child' ),
		'uploaded_to_this_item' => __( 'Uploaded to this tool', 'bb-theme-child' ),
		'items_list'            => __( 'Tools list', 'bb-theme-child' ),
		'items_list_navigation' => __( 'Tools list navigation', 'bb-theme-child' ),
		'filter_items_list'     => __( 'Filter tools list', 'bb-theme-child' ),
	);
	$args = array(
		'label'                 => __( 'Tool', 'bb-theme-child' ),
		'description'           => __( 'NPEC Tools', 'bb-theme-child' ),
		'labels'                => $labels,
		'supports'              => array( 'title', 'editor', 'thumbnail', 'revisions' ),
		'hierarchical'          => false,
		'public'                => true,
		'show_ui'               => true,
		'show_in_menu'          => true,
		'menu_position'         => 5,
		'menu_icon'             => 'dashicons-admin-tools',
		'show_in_admin_bar'     => true,
		'show_in_nav_menus'     => true,
		'can_export'            => true,
		'has_archive'           => 'tools',
		'exclude_from_search'   => false,
		'publicly_queryable'    => true,
		'capability_type'       => 'post',
		'show_in_rest'          => true,
	);
	register_post_type( 'tool', $args );

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

}