Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Projects post type

if ( ! function_exists('tmm_project_post_type') ) {

// Register Custom Post Type
function tmm_project_post_type() {

	$labels = array(
		'name'                => _x( 'projects', 'Post Type General Name', 'tmm' ),
		'singular_name'       => _x( 'project', 'Post Type Singular Name', 'tmm' ),
		'menu_name'           => __( 'Projects', 'tmm' ),
		'name_admin_bar'      => __( 'Projects', 'tmm' ),
		'parent_item_colon'   => __( 'Parent Project:', 'tmm' ),
		'all_items'           => __( 'All projects', 'tmm' ),
		'add_new_item'        => __( 'Add New Project', 'tmm' ),
		'add_new'             => __( 'Add New', 'tmm' ),
		'new_item'            => __( 'New Project', 'tmm' ),
		'edit_item'           => __( 'Edit Project', 'tmm' ),
		'update_item'         => __( 'Update Project', 'tmm' ),
		'view_item'           => __( 'View Project', 'tmm' ),
		'search_items'        => __( 'Search Project', 'tmm' ),
		'not_found'           => __( 'Not found', 'tmm' ),
		'not_found_in_trash'  => __( 'Not found in Trash', 'tmm' ),
	);
	$args = array(
		'label'               => __( 'projects', 'tmm' ),
		'description'         => __( 'Portfolio's projects', 'tmm' ),
		'labels'              => $labels,
		'supports'            => array( 'title', 'editor', 'excerpt', 'thumbnail', 'revisions', ),
		'hierarchical'        => false,
		'public'              => true,
		'show_ui'             => true,
		'show_in_menu'        => true,
		'menu_position'       => 20,
		'menu_icon'           => 'dashicons-portfolio',
		'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( 'projects', $args );

}

// Hook into the 'init' action
add_action( 'init', 'tmm_project_post_type', 0 );

}