Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Huy V Laptop post type

// Register Custom Post Type
function custom_post_type_laptop() {

	$labels = array(
		'name'                  => _x( 'Laptops', 'Post Type General Name', 'huyv' ),
		'singular_name'         => _x( 'Laptop', 'Post Type Singular Name', 'huyv' ),
		'menu_name'             => __( 'Laptops', 'huyv' ),
		'name_admin_bar'        => __( 'Laptop', 'huyv' ),
		'archives'              => __( 'Laptop Archives', 'huyv' ),
		'attributes'            => __( 'Laptop Attributes', 'huyv' ),
		'parent_item_colon'     => __( 'Parent Laptop:', 'huyv' ),
		'all_items'             => __( 'All Laptops', 'huyv' ),
		'add_new_item'          => __( 'Add New Laptop', 'huyv' ),
		'add_new'               => __( 'Add New', 'huyv' ),
		'new_item'              => __( 'New Laptop', 'huyv' ),
		'edit_item'             => __( 'Edit Laptop', 'huyv' ),
		'update_item'           => __( 'Update Laptop', 'huyv' ),
		'view_item'             => __( 'View Laptop', 'huyv' ),
		'view_items'            => __( 'View Laptops', 'huyv' ),
		'search_items'          => __( 'Search Laptop', 'huyv' ),
		'not_found'             => __( 'Not found', 'huyv' ),
		'not_found_in_trash'    => __( 'Not found in Trash', 'huyv' ),
		'featured_image'        => __( 'Featured Image', 'huyv' ),
		'set_featured_image'    => __( 'Set featured image', 'huyv' ),
		'remove_featured_image' => __( 'Remove featured image', 'huyv' ),
		'use_featured_image'    => __( 'Use as featured image', 'huyv' ),
		'insert_into_item'      => __( 'Insert into Laptop', 'huyv' ),
		'uploaded_to_this_item' => __( 'Uploaded to this Laptop', 'huyv' ),
		'items_list'            => __( 'Laptops list', 'huyv' ),
		'items_list_navigation' => __( 'Laptops list navigation', 'huyv' ),
		'filter_items_list'     => __( 'Filter Laptops list', 'huyv' ),
	);
	$args = array(
		'label'                 => __( 'Laptop', 'huyv' ),
		'description'           => __( 'Dịch vụ laptop', 'huyv' ),
		'labels'                => $labels,
		'supports'              => array( 'title', 'editor', 'thumbnail', 'comments', 'trackbacks', 'revisions', 'custom-fields', 'page-attributes', 'post-formats' ),
		'hierarchical'          => false,
		'public'                => true,
		'show_ui'               => true,
		'show_in_menu'          => true,
		'menu_position'         => 5,
		'menu_icon'             => 'dashicons-clipboard',
		'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'       => 'page',
	);
	register_post_type( 'laptop', $args );

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