Created
November 1, 2021 03:09
-
-
Save jasperf/e4fca9f287befc903ed052b3d4b13884 to your computer and use it in GitHub Desktop.
Event Custom Post Type made with CPT UI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cptui_register_my_cpts_event() { | |
/** | |
* Post Type: Events. | |
*/ | |
$labels = [ | |
"name" => __( "Events", "custom-post-type-ui" ), | |
"singular_name" => __( "Event", "custom-post-type-ui" ), | |
"menu_name" => __( "My Events", "custom-post-type-ui" ), | |
"all_items" => __( "All Events", "custom-post-type-ui" ), | |
"add_new" => __( "Add new", "custom-post-type-ui" ), | |
"add_new_item" => __( "Add new Event", "custom-post-type-ui" ), | |
"edit_item" => __( "Edit Event", "custom-post-type-ui" ), | |
"new_item" => __( "New Event", "custom-post-type-ui" ), | |
"view_item" => __( "View Event", "custom-post-type-ui" ), | |
"view_items" => __( "View Events", "custom-post-type-ui" ), | |
"search_items" => __( "Search Events", "custom-post-type-ui" ), | |
"not_found" => __( "No Events found", "custom-post-type-ui" ), | |
"not_found_in_trash" => __( "No Events found in trash", "custom-post-type-ui" ), | |
"parent" => __( "Parent Event:", "custom-post-type-ui" ), | |
"featured_image" => __( "Featured image for this Event", "custom-post-type-ui" ), | |
"set_featured_image" => __( "Set featured image for this Event", "custom-post-type-ui" ), | |
"remove_featured_image" => __( "Remove featured image for this Event", "custom-post-type-ui" ), | |
"use_featured_image" => __( "Use as featured image for this Event", "custom-post-type-ui" ), | |
"archives" => __( "Event archives", "custom-post-type-ui" ), | |
"insert_into_item" => __( "Insert into Event", "custom-post-type-ui" ), | |
"uploaded_to_this_item" => __( "Upload to this Event", "custom-post-type-ui" ), | |
"filter_items_list" => __( "Filter Events list", "custom-post-type-ui" ), | |
"items_list_navigation" => __( "Events list navigation", "custom-post-type-ui" ), | |
"items_list" => __( "Events list", "custom-post-type-ui" ), | |
"attributes" => __( "Events attributes", "custom-post-type-ui" ), | |
"name_admin_bar" => __( "Event", "custom-post-type-ui" ), | |
"item_published" => __( "Event published", "custom-post-type-ui" ), | |
"item_published_privately" => __( "Event published privately.", "custom-post-type-ui" ), | |
"item_reverted_to_draft" => __( "Event reverted to draft.", "custom-post-type-ui" ), | |
"item_scheduled" => __( "Event scheduled", "custom-post-type-ui" ), | |
"item_updated" => __( "Event updated.", "custom-post-type-ui" ), | |
"parent_item_colon" => __( "Parent Event:", "custom-post-type-ui" ), | |
]; | |
$args = [ | |
"label" => __( "Events", "custom-post-type-ui" ), | |
"labels" => $labels, | |
"description" => "", | |
"public" => true, | |
"publicly_queryable" => true, | |
"show_ui" => true, | |
"show_in_rest" => true, | |
"rest_base" => "", | |
"rest_controller_class" => "WP_REST_Posts_Controller", | |
"has_archive" => false, | |
"show_in_menu" => true, | |
"show_in_nav_menus" => true, | |
"delete_with_user" => false, | |
"exclude_from_search" => false, | |
"capability_type" => "post", | |
"map_meta_cap" => true, | |
"hierarchical" => false, | |
"rewrite" => [ "slug" => "event", "with_front" => true ], | |
"query_var" => true, | |
"menu_icon" => "dashicons-calendar-alt", | |
"supports" => [ "title", "editor", "thumbnail", "excerpt" ], | |
"taxonomies" => [ "event_category" ], | |
"show_in_graphql" => false, | |
]; | |
register_post_type( "event", $args ); | |
} | |
add_action( 'init', 'cptui_register_my_cpts_event' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment