Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Warp Vehicles

basic custom post type for vehicles

if ( ! function_exists('warp_vehicles') ) {

// Register Custom Post Type
function warp_vehicles() {

	$labels = array(
		'name'                  => _x( 'Vehicles', 'Post Type General Name', 'understrap-child' ),
		'singular_name'         => _x( 'Vehicle', 'Post Type Singular Name', 'understrap-child' ),
		'menu_name'             => __( 'Vehicles', 'understrap-child' ),
		'name_admin_bar'        => __( 'Vehicle', 'understrap-child' ),
		'archives'              => __( 'Vehicle Archives', 'understrap-child' ),
		'attributes'            => __( 'Vehicle Attributes', 'understrap-child' ),
		'parent_item_colon'     => __( 'Parent Vehicle:', 'understrap-child' ),
		'all_items'             => __( 'All Vehicles', 'understrap-child' ),
		'add_new_item'          => __( 'Add New Vehicle', 'understrap-child' ),
		'add_new'               => __( 'Add New', 'understrap-child' ),
		'new_item'              => __( 'New Vehicle', 'understrap-child' ),
		'edit_item'             => __( 'Edit Vehicle', 'understrap-child' ),
		'update_item'           => __( 'Update Vehicle', 'understrap-child' ),
		'view_item'             => __( 'View Vehicle', 'understrap-child' ),
		'view_items'            => __( 'View Vehicles', 'understrap-child' ),
		'search_items'          => __( 'Search Vehicle', 'understrap-child' ),
		'not_found'             => __( 'Not found', 'understrap-child' ),
		'not_found_in_trash'    => __( 'Not found in Trash', 'understrap-child' ),
		'featured_image'        => __( 'Featured Image', 'understrap-child' ),
		'set_featured_image'    => __( 'Set featured image', 'understrap-child' ),
		'remove_featured_image' => __( 'Remove featured image', 'understrap-child' ),
		'use_featured_image'    => __( 'Use as featured image', 'understrap-child' ),
		'insert_into_item'      => __( 'Insert into Vehicle', 'understrap-child' ),
		'uploaded_to_this_item' => __( 'Uploaded to this Vehicle', 'understrap-child' ),
		'items_list'            => __( 'Vehicles list', 'understrap-child' ),
		'items_list_navigation' => __( 'Vehicles list navigation', 'understrap-child' ),
		'filter_items_list'     => __( 'Filter Vehicles list', 'understrap-child' ),
	);
	$args = array(
		'label'                 => __( 'Vehicle', 'understrap-child' ),
		'description'           => __( 'Vehicles custom post type, coded, no plugin.Post Type Description 1', 'understrap-child' ),
		'labels'                => $labels,
		'supports'              => array( 'title', 'editor', 'thumbnail', 'comments', 'revisions', 'custom-fields', '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-carrot',
		'show_in_admin_bar'     => true,
		'show_in_nav_menus'     => true,
		'can_export'            => true,
		'has_archive'           => 'vehicles',
		'exclude_from_search'   => false,
		'publicly_queryable'    => true,
		'capability_type'       => 'page',
	);
	register_post_type( 'warp_vehicles', $args );

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

}