<?php
// Register Custom Post Type
function custom_post_type() {
$lables = array(
'name' => __( 'Events', 'text_domain)' ),
'singular_name' => __( 'Event', 'text_domain' ),
'menu_name' => __( 'Events', 'text_domain' ),
'name_admin_bar' => __( 'Event', 'text_domain' ),
'archives' => __( 'Event Archives', 'text_domain' ),
'attributes' => __( 'EventAttributes', 'text_domain' ),
'parent_item_colon' => __( 'Parent Event:', 'text_domain' ),
'all_items' => __( 'All Events', 'text_domain' ),
'add_new_item' => __( 'Add New Event', 'text_domain' ),
'add_new' => __( 'Add New', 'text_domain' ),
'new_item' => __( 'New Event', 'text_domain' ),
'edit_item' => __( 'Edit Event', 'text_domain' ),
'update_item' => __( 'Update Event', 'text_domain' ),
'view_item' => __( 'View Event', 'text_domain' ),
'view_items' => __( 'Views Event', 'text_domain' ),
'search_items' => __( 'Search Events', 'text_domain' ),
'not_found' => __( 'Not found', 'text_domain' ),
'not_found_in_trash' => __( 'Not found in trash', 'text_domain' ),
'featured_image' => __( 'Featured Image for this event', 'text_domain' ),
'set_featured_image' => __( 'Set featured image for this event', 'text_domain' ),
'remove_featured_image' => __( 'Remove featured image for this event', 'text_domain' ),
'use_featured_image' => __( 'Use as featured image for this event', 'text_domain' ),
'insert_into_item' => __( 'Insert into event', 'text_domain' ),
'uploaded_to_this_item' => __( 'Uploaded to this event', 'text_domain' )
'items_list' => __( 'Events list', 'text_domain' ),
'items_list_navigation' => __( 'Events list navigation', 'text_domain' ),
'filter_items_list' => __( 'Filter events list', 'text_domain' ),
);
$args = array(
'label' => __( 'Event', 'text_domain' ),
'description' => __( 'Event Post Type Description', 'text_domain' ),
'labels' => $lables,
'supports' => array( 'title', 'editor', 'thumbnail' ),
'taxonomies' => array( 'event_location', 'event_type' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-megaphone',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'post',
'show_in_rest' => true,
);
register_post_type( 'event', $args );
}
add_action( 'init', 'custom_post_type', 0 );
?>
What is post type?
The post types are the way to manage the different variety of content. By default, WordPress only allows five types of content posts, pages, revisions, attachments, and nav menu.
You can make your custom post type to show the type of material you want to show on your website. Like books, movies, reviews, items, products, recipes, courses, FAQs, and many more you can create.
You can create your custom post type in a programmatically way or with the help of a plugin. For more details, you can check the tutorial here. But if you don’t know programming then you can use this tool to create a new post type.
What is a WP Post Type Generator?
WP Post Type Generator is a free online tool for creating a custom WordPress post type. You can make unlimited custom post types using this tool.
You can use this tool simply and easily to create custom post types in your WordPress site and manage them differently without mixing them into default post types like pages and posts, etc.
Note: This site does not store any type of data, password, or other sensitive data so that you can safely fill in your information.
How to use WP Post Type Generator?
To use this tool, you simply need to select the corresponding tab fill in the required fields, and then click on the “Generate” button.
Follow the below steps:
- Select the tabs one by one
- Fill in the required fields. Some of the fields have default values but you can change them as per your need.
- Click on the “Generate” button
- Generated code will shown in the result area and you can copy the code and use it.
- To generate a new file code click on the “Refresh” button,