Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Tickets

if ( ! function_exists('hm_register_cpt_ticket') ) {

// Register Custom Post Type
function hm_register_cpt_ticket() {

	$labels = array(
		'name'                  => _x( 'Tickets', 'Post Type General Name', 'hm-portal' ),
		'singular_name'         => _x( 'Ticket', 'Post Type Singular Name', 'hm-portal' ),
		'menu_name'             => __( 'Tickets', 'hm-portal' ),
		'name_admin_bar'        => __( 'Ticket', 'hm-portal' ),
		'archives'              => __( 'Ticket Archives', 'hm-portal' ),
		'attributes'            => __( 'Ticket Attributes', 'hm-portal' ),
		'parent_item_colon'     => __( 'Parent Ticket:', 'hm-portal' ),
		'all_items'             => __( 'All Tickets', 'hm-portal' ),
		'add_new_item'          => __( 'Add New Ticket', 'hm-portal' ),
		'add_new'               => __( 'Add New', 'hm-portal' ),
		'new_item'              => __( 'New Ticket', 'hm-portal' ),
		'edit_item'             => __( 'Edit Ticket', 'hm-portal' ),
		'update_item'           => __( 'Update Ticket', 'hm-portal' ),
		'view_item'             => __( 'View Ticket', 'hm-portal' ),
		'view_items'            => __( 'View Tickets', 'hm-portal' ),
		'search_items'          => __( 'Search Ticket', 'hm-portal' ),
		'not_found'             => __( 'Not found', 'hm-portal' ),
		'not_found_in_trash'    => __( 'Not found in Trash', 'hm-portal' ),
		'featured_image'        => __( 'Featured Image', 'hm-portal' ),
		'set_featured_image'    => __( 'Set featured image', 'hm-portal' ),
		'remove_featured_image' => __( 'Remove featured image', 'hm-portal' ),
		'use_featured_image'    => __( 'Use as featured image', 'hm-portal' ),
		'insert_into_item'      => __( 'Insert into Ticket', 'hm-portal' ),
		'uploaded_to_this_item' => __( 'Uploaded to this Ticket', 'hm-portal' ),
		'items_list'            => __( 'Tickets list', 'hm-portal' ),
		'items_list_navigation' => __( 'Tickets list navigation', 'hm-portal' ),
		'filter_items_list'     => __( 'Filter Tickets list', 'hm-portal' ),
	);
	$args = array(
		'label'                 => __( 'Ticket', 'hm-portal' ),
		'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-sos',
		'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( 'ticket', $args );

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

}