Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Projets Portfolio

if ( ! function_exists('projet') ) {

// Register Custom Post Type
function projet() {

	$labels = array(
		'name'                => _x( 'Projects', 'Post Type General Name', 'dik' ),
		'singular_name'       => _x( 'Project', 'Post Type Singular Name', 'dik' ),
		'menu_name'           => __( 'Portfolio', 'dik' ),
		'name_admin_bar'      => __( 'Portfolio', 'dik' ),
		'parent_item_colon'   => __( 'Parent Project :', 'dik' ),
		'all_items'           => __( 'All Projects', 'dik' ),
		'add_new_item'        => __( 'Add New Project', 'dik' ),
		'add_new'             => __( 'Add New', 'dik' ),
		'new_item'            => __( 'New Project', 'dik' ),
		'edit_item'           => __( 'Edit Project', 'dik' ),
		'update_item'         => __( 'Update Project', 'dik' ),
		'view_item'           => __( 'View Project', 'dik' ),
		'search_items'        => __( 'Search Project', 'dik' ),
		'not_found'           => __( 'Not found', 'dik' ),
		'not_found_in_trash'  => __( 'Not found in Trash', 'dik' ),
	);
	$rewrite = array(
		'slug'                => 'portfolio',
		'with_front'          => true,
		'pages'               => true,
		'feeds'               => true,
	);
	$args = array(
		'label'               => __( 'projets', 'dik' ),
		'description'         => __( 'Projects', 'dik' ),
		'labels'              => $labels,
		'supports'            => array( 'title', 'editor', 'excerpt', 'thumbnail', 'page-attributes', ),
		'taxonomies'          => array( 'category', 'post_tag' ),
		'hierarchical'        => false,
		'public'              => true,
		'show_ui'             => true,
		'show_in_menu'        => true,
		'menu_position'       => 20,
		'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,
		'rewrite'             => $rewrite,
		'capability_type'     => 'page',
	);
	register_post_type( 'projets', $args );

}

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

}