Properties

Home » Snippets » Properties
0

Created with:

Post Type Generator

Visibility: 

public

Creator: Muhammad Raheem

Customize with WPTurbo AI
X

Add Snippet To Project

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

	$args = [
		'label' => __( 'Property', 'Property listing' ),
		'description' => __( 'Property listing', 'Property listing' ),
		'labels' => $labels,
		'supports' => [
			'title',
			'editor',
			'author',
			'thumbnail',
			'comments',
			'custom-fields',
			'page-attributes',
			'post-formats',
		],
		'hierarchical' => true,
		'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,
		'exclude_from_search' => false,
		'has_archive' => false,
		'can_export' => true,
		'rewrite' => [
			'slug' => 'Properties',
			'with_front' => true,
			'pages' => false,
			'feeds' => false,
		],
		'capability_type' => 'post',
		'show_in_rest' => true,
	];
	$args = apply_filters( 'property_post-args', $args );

	register_post_type( 'property_post', $args );
}
add_action( 'init', 'wpturbo_register_my_custom_post_type', 0 );
			

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