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