<?php

/**
 * Register a custom post type called "events".
 *
 * @see get_post_type_labels() for label keys.
 */

function post_type__events() {
    
    $labels = array(
        'name'                  => _x( 'Events', 'Post type general name', 'mpwbpk' ),
        'singular_name'         => _x( 'Event', 'Post type singular name', 'mpwbpk' ),
        'menu_name'             => _x( 'Events', 'Admin Menu text', 'mpwbpk' ),
        'name_admin_bar'        => _x( 'Events', 'Add New on Toolbar', 'mpwbpk' ),
        'add_new'               => __( 'Add Event', 'mpwbpk' ),
        'add_new_item'          => __( 'Add New Event', 'mpwbpk' ),
        'new_item'              => __( 'New Event', 'mpwbpk' ),
        'edit_item'             => __( 'Edit Event', 'mpwbpk' ),
        'view_item'             => __( 'View Event', 'mpwbpk' ),
        'all_items'             => __( 'All Events', 'mpwbpk' ),
        'search_items'          => __( 'Search Events', 'mpwbpk' ),
        'parent_item_colon'     => __( 'Parent Event:', 'mpwbpk' ),
        'not_found'             => __( 'No Events found.', 'mpwbpk' ),
        'not_found_in_trash'    => __( 'No Events found in Trash.', 'mpwbpk' ),
        'featured_image'        => _x( 'Event Cover Image', 'Overrides the “Featured Image” phrase for this post type. Added in 4.3', 'mpwbpk' ),
        'set_featured_image'    => _x( 'Set cover image', 'Overrides the “Set featured image” phrase for this post type. Added in 4.3', 'mpwbpk' ),
        'remove_featured_image' => _x( 'Remove cover image', 'Overrides the “Remove featured image” phrase for this post type. Added in 4.3', 'mpwbpk' ),
        'use_featured_image'    => _x( 'Use as cover image', 'Overrides the “Use as featured image” phrase for this post type. Added in 4.3', 'mpwbpk' ),
        'archives'              => _x( 'Events archives', 'The post type archive label used in nav menus. Default “Post Archives”. Added in 4.4', 'mpwbpk' ),
        'insert_into_item'      => _x( 'Insert into Event', 'Overrides the “Insert into post”/”Insert into page” phrase (used when inserting media into a post). Added in 4.4', 'mpwbpk' ),
        'uploaded_to_this_item' => _x( 'Uploaded to this Event', 'Overrides the “Uploaded to this post”/”Uploaded to this page” phrase (used when viewing media attached to a post). Added in 4.4', 'mpwbpk' ),
        'filter_items_list'     => _x( 'Filter Event list', 'Screen reader text for the filter links heading on the post type listing screen. Default “Filter posts list”/”Filter pages list”. Added in 4.4', 'mpwbpk' ),
        'items_list_navigation' => _x( 'Event list navigation', 'Screen reader text for the pagination heading on the post type listing screen. Default “Posts list navigation”/”Pages list navigation”. Added in 4.4', 'mpwbpk' ),
        'items_list'            => _x( 'Event list', 'Screen reader text for the items list heading on the post type listing screen. Default “Posts list”/”Pages list”. Added in 4.4', 'mpwbpk' ),
    );
 
    $args = array(
        'labels'             => $labels,
        'public'             => true, // false = Hide in SERP
        'menu_position'      => 5,
        'publicly_queryable' => true,
        'show_ui'            => true,
        'show_in_menu'       => true,
        'query_var'          => true,
        'rewrite'            => array( 'slug' => 'events' ),
        'capability_type'    => 'post',
        'exclude_from_search' => false,
        'has_archive'        => false,
        'hierarchical'       => false,
        'menu_position'      => null,
        'supports'           => array( 'title', 'editor', 'thumbnail' ),
        'menu_icon'   		 => 'dashicons-calendar-alt',
        'show_in_rest'       => true,
    );
 
    register_post_type( 'events', $args );
}
 
add_action( 'init', 'post_type__events' );