0
X
Add Snippet To Project
New Project
Add To Existing Project
/**
* Registers a custom post type 'coche'.
*
* @since 1.0.0
*
* @return void
*/
function lmb_reg_coche_cpt() : void {
$labels = [
'name' => _x( 'Coches', 'Post Type General Name', 'lmb' ),
'singular_name' => _x( 'Coche', 'Post Type Singular Name', 'lmb' ),
'menu_name' => __( 'Coches', 'lmb' ),
'name_admin_bar' => __( 'Coches', 'lmb' ),
'archives' => __( 'Coches Archives', 'lmb' ),
'attributes' => __( 'Coches Attributes', 'lmb' ),
'parent_item_colon' => __( 'Parent Coche:', 'lmb' ),
'all_items' => __( 'All Coches', 'lmb' ),
'add_new_item' => __( 'Add New Coche', 'lmb' ),
'add_new' => __( 'Add New', 'lmb' ),
'new_item' => __( 'New Coche', 'lmb' ),
'edit_item' => __( 'Edit Coche', 'lmb' ),
'update_item' => __( 'Update Coche', 'lmb' ),
'view_item' => __( 'View Coche', 'lmb' ),
'view_items' => __( 'View Coches', 'lmb' ),
'search_items' => __( 'Search Coches', 'lmb' ),
'not_found' => __( 'Coche Not Found', 'lmb' ),
'not_found_in_trash' => __( 'Coche Not Found in Trash', 'lmb' ),
'featured_image' => __( 'Featured Image', 'lmb' ),
'set_featured_image' => __( 'Set Featured Image', 'lmb' ),
'remove_featured_image' => __( 'Remove Featured Image', 'lmb' ),
'use_featured_image' => __( 'Use as Featured Image', 'lmb' ),
'insert_into_item' => __( 'Insert into Coche', 'lmb' ),
'uploaded_to_this_item' => __( 'Uploaded to this Coche', 'lmb' ),
'items_list' => __( 'Coches List', 'lmb' ),
'items_list_navigation' => __( 'Coches List Navigation', 'lmb' ),
'filter_items_list' => __( 'Filter Coches List', 'lmb' ),
];
$labels = apply_filters( 'coche-labels', $labels );
$args = [
'label' => __( 'Coche', 'lmb' ),
'description' => __( 'Post type de coches', 'lmb' ),
'labels' => $labels,
'supports' => [
'title',
'editor',
'excerpt',
'author',
'thumbnail',
'page-attributes',
],
'taxonomies' => [
'marca',
],
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-admin-post',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'has_archive' => true,
'can_export' => false,
'capability_type' => 'page',
'show_in_rest' => true,
];
$args = apply_filters( 'coche-args', $args );
register_post_type( 'coche', $args );
}
add_action( 'init', 'lmb_reg_coche_cpt', 0 );