Services Automobiles

Home » Snippets » Services Automobiles
0

Created with:

Post Type Generator

Visibility: 

public

Creator: Houssam

Customize with WPTurbo AI
X

Add Snippet To Project

New Project
Add To Existing Project
				/**
 * Registers a custom post type 'service'.
 *
 * @since 1.0.0
 *
 * @return void
 */
function automobile_register_cpt_service() : void {
	$labels = [
		'name' => _x( 'Services', 'Post Type General Name', 'automobile' ),
		'singular_name' => _x( 'Service', 'Post Type Singular Name', 'automobile' ),
		'menu_name' => __( 'Services', 'automobile' ),
		'name_admin_bar' => __( 'Services', 'automobile' ),
		'archives' => __( 'Services Archives', 'automobile' ),
		'attributes' => __( 'Services Attributes', 'automobile' ),
		'parent_item_colon' => __( 'Parent Service:', 'automobile' ),
		'all_items' => __( 'All Services', 'automobile' ),
		'add_new_item' => __( 'Add New Service', 'automobile' ),
		'add_new' => __( 'Créer', 'automobile' ),
		'new_item' => __( 'New Service', 'automobile' ),
		'edit_item' => __( 'Edit Service', 'automobile' ),
		'update_item' => __( 'Update Service', 'automobile' ),
		'view_item' => __( 'View Service', 'automobile' ),
		'view_items' => __( 'View Services', 'automobile' ),
		'search_items' => __( 'Search Services', 'automobile' ),
		'not_found' => __( 'Service Not Found', 'automobile' ),
		'not_found_in_trash' => __( 'Service Not Found in Trash', 'automobile' ),
		'featured_image' => __( 'Featured Image', 'automobile' ),
		'set_featured_image' => __( 'Set Featured Image', 'automobile' ),
		'remove_featured_image' => __( 'Remove Featured Image', 'automobile' ),
		'use_featured_image' => __( 'Use as Featured Image', 'automobile' ),
		'insert_into_item' => __( 'Insert into Service', 'automobile' ),
		'uploaded_to_this_item' => __( 'Uploaded to this Service', 'automobile' ),
		'items_list' => __( 'Services List', 'automobile' ),
		'items_list_navigation' => __( 'Services List Navigation', 'automobile' ),
		'filter_items_list' => __( 'Filter Services List', 'automobile' ),
	];
	$labels = apply_filters( 'service-labels', $labels );

	$args = [
		'label' => __( 'Service', 'automobile' ),
		'description' => __( 'Services Automobiles', 'automobile' ),
		'labels' => $labels,
		'supports' => [
			'title',
			'editor',
			'author',
			'thumbnail',
			'comments',
		],
		'taxonomies' => [
			'category',
		],
		'hierarchical' => false,
		'public' => true,
		'show_ui' => true,
		'show_in_menu' => true,
		'menu_position' => 5,
		'menu_icon' => 'dashicons-admin-tools',
		'show_in_admin_bar' => true,
		'show_in_nav_menus' => true,
		'query_var' => 'service',
		'exclude_from_search' => false,
		'has_archive' => false,
		'can_export' => false,
		'capability_type' => 'post',
		'show_in_rest' => true,
	];
	$args = apply_filters( 'service-args', $args );

	register_post_type( 'service', $args );
}
add_action( 'init', 'automobile_register_cpt_service', 0 );
			

Register an account to save your snippets or go Pro to get more features.