Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

rdv

plugin rdv crud

if ( ! function_exists('om_rdv_cpt') ) {

// Register Custom Post Type
function om_rdv_cpt() {

	$labels = array(
		'name'                  => _x( 'rdvs', 'Post Type General Name', 'om_rdv' ),
		'singular_name'         => _x( 'rdv', 'Post Type Singular Name', 'om_rdv' ),
		'menu_name'             => __( 'Rendez vous', 'om_rdv' ),
		'name_admin_bar'        => __( 'Rendez vous', 'om_rdv' ),
		'archives'              => __( 'Rendez vous Archives', 'om_rdv' ),
		'attributes'            => __( 'Rendez vous Attributes', 'om_rdv' ),
		'parent_item_colon'     => __( 'Parent Rendez vous:', 'om_rdv' ),
		'all_items'             => __( 'Tous les Rendez vous', 'om_rdv' ),
		'add_new_item'          => __( 'Add New Rendez vous', 'om_rdv' ),
		'add_new'               => __( 'Add New', 'om_rdv' ),
		'new_item'              => __( 'New Rendez vous', 'om_rdv' ),
		'edit_item'             => __( 'Edit Rendez vous', 'om_rdv' ),
		'update_item'           => __( 'Update Rendez vous', 'om_rdv' ),
		'view_item'             => __( 'View Rendez vous', 'om_rdv' ),
		'view_items'            => __( 'View Rendez vous', 'om_rdv' ),
		'search_items'          => __( 'Search Rendez vous', 'om_rdv' ),
		'not_found'             => __( 'Not found', 'om_rdv' ),
		'not_found_in_trash'    => __( 'Not found in Trash', 'om_rdv' ),
		'featured_image'        => __( 'Featured Image', 'om_rdv' ),
		'set_featured_image'    => __( 'Set featured image', 'om_rdv' ),
		'remove_featured_image' => __( 'Remove featured image', 'om_rdv' ),
		'use_featured_image'    => __( 'Use as featured image', 'om_rdv' ),
		'insert_into_item'      => __( 'Insert into Rendez vous', 'om_rdv' ),
		'uploaded_to_this_item' => __( 'Uploaded to this Rendez vous', 'om_rdv' ),
		'items_list'            => __( 'Rendez vous list', 'om_rdv' ),
		'items_list_navigation' => __( 'Rendez vous list navigation', 'om_rdv' ),
		'filter_items_list'     => __( 'Filter Rendez vous list', 'om_rdv' ),
	);
	$rewrite = array(
		'slug'                  => 'RDV',
		'with_front'            => true,
		'pages'                 => true,
		'feeds'                 => true,
	);
	$capabilities = array(
		'edit_post'             => 'edit_page',
		'read_post'             => 'read_page',
		'delete_post'           => 'delete_page',
		'edit_posts'            => 'edit_pages',
		'publish_posts'         => 'publish_posts',
	);
	$args = array(
		'label'                 => __( 'rdv', 'om_rdv' ),
		'description'           => __( 'Formulaire de rendez vous professionnel à destination de coiffeurs', 'om_rdv' ),
		'labels'                => $labels,
		'supports'              => array( 'title', 'editor', 'custom-fields' ),
		'hierarchical'          => false,
		'public'                => true,
		'show_ui'               => true,
		'show_in_menu'          => true,
		'menu_position'         => 5,
		'menu_icon'             => 'dashicons-calendar-alt',
		'show_in_admin_bar'     => true,
		'show_in_nav_menus'     => true,
		'can_export'            => true,
		'has_archive'           => false,
		'exclude_from_search'   => true,
		'publicly_queryable'    => true,
		'query_var'             => 'post_type',
		'rewrite'               => $rewrite,
		'capabilities'          => $capabilities,
		'show_in_rest'          => true,
	);
	register_post_type( 'om_rdv', $args );

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

}