Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

services cpt

// Register Custom Post Type
function services() {

	$labels = array(
		'name'                  => _x( 'Services', 'Post Type General Name', 'joinweb' ),
		'singular_name'         => _x( 'Service', 'Post Type Singular Name', 'joinweb' ),
		'menu_name'             => __( 'Services', 'joinweb' ),
		'name_admin_bar'        => __( 'Services', 'joinweb' ),
		'archives'              => __( 'Service Archives', 'joinweb' ),
		'attributes'            => __( 'Service Attributes', 'joinweb' ),
		'parent_item_colon'     => __( 'Parent Service:', 'joinweb' ),
		'all_items'             => __( 'All Services', 'joinweb' ),
		'add_new_item'          => __( 'Add New Service', 'joinweb' ),
		'add_new'               => __( 'Add New', 'joinweb' ),
		'new_item'              => __( 'New Service', 'joinweb' ),
		'edit_item'             => __( 'Edit Service', 'joinweb' ),
		'update_item'           => __( 'Update Service', 'joinweb' ),
		'view_item'             => __( 'View Service', 'joinweb' ),
		'view_items'            => __( 'View Services', 'joinweb' ),
		'search_items'          => __( 'Search Service', 'joinweb' ),
		'not_found'             => __( 'Not found', 'joinweb' ),
		'not_found_in_trash'    => __( 'Not found in Trash', 'joinweb' ),
		'featured_image'        => __( 'Featured Image', 'joinweb' ),
		'set_featured_image'    => __( 'Set featured image', 'joinweb' ),
		'remove_featured_image' => __( 'Remove featured image', 'joinweb' ),
		'use_featured_image'    => __( 'Use as featured image', 'joinweb' ),
		'insert_into_item'      => __( 'Insert into Service', 'joinweb' ),
		'uploaded_to_this_item' => __( 'Uploaded to this Service', 'joinweb' ),
		'items_list'            => __( 'Services list', 'joinweb' ),
		'items_list_navigation' => __( 'Services list navigation', 'joinweb' ),
		'filter_items_list'     => __( 'Filter Services list', 'joinweb' ),
	);
	$rewrite = array(
		'slug'                  => 'services',
		'with_front'            => true,
		'pages'                 => true,
		'feeds'                 => true,
	);
	$args = array(
		'label'                 => __( 'Service', 'joinweb' ),
		'description'           => __( 'Offered serives', 'joinweb' ),
		'labels'                => $labels,
		'supports'              => array( 'title', 'editor', 'thumbnail', 'revisions', ),
		'taxonomies'            => array( 'service_type' ),
		'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'           => 'services',
		'exclude_from_search'   => false,
		'publicly_queryable'    => true,
		'query_var'             => 'services',
		'rewrite'               => $rewrite,
		'capability_type'       => 'page',
	);
	register_post_type( 'services', $args );

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