<?php

// Register Faculty Post Type
function uiu_cpt_faculty()
{

    $labels = array(
        'name'                  => 'Faculties',
        'singular_name'         => 'Faculty',
        'menu_name'             => 'Faculties',
        'name_admin_bar'        => 'Post Type',
        'archives'              => 'Faculty Archives',
        'attributes'            => 'Faculty Attributes',
        'parent_item_colon'     => 'Parent Faculty:',
        'all_items'             => 'All Faculties',
        'add_new_item'          => 'Add New Faculty',
        'add_new'               => 'Add New',
        'new_item'              => 'New Faculty',
        'edit_item'             => 'Edit Faculty',
        'update_item'           => 'Update Faculty',
        'view_item'             => 'View Faculty',
        'view_items'            => 'View Faculties',
        'search_items'          => 'Search Faculty',
        'featured_image'        => 'Cover Image',
        'set_featured_image'    => 'Set cover image',
        'remove_featured_image' => 'Remove cover image',
        'use_featured_image'    => 'Use as cover image',
        'insert_into_item'      => 'Insert into faculty',
        'uploaded_to_this_item' => 'Uploaded to this faculty',
        'items_list'            => 'Faculties list',
        'items_list_navigation' => 'Faculties list navigation',
        'filter_items_list'     => 'Filter faculties list',
    );
    $rewrite = array(
        'slug'                  => 'faculty',
        'with_front'            => true,
        'pages'                 => true,
        'feeds'                 => true,
    );
    $args = array(
        'label'                 => 'Faculty',
        'description'           => 'Faculty of Department of CSE',
        'labels'                => $labels,
        'supports'              => array('title', 'thumbnail', 'revisions'),
        // 'taxonomies'            => array('category', 'post_tag'),
        'hierarchical'          => false,
        'public'                => true,
        'show_ui'               => true,
        'show_in_menu'          => true,
        'menu_position'         => 11,
        'menu_icon'             => 'dashicons-businessperson',
        'show_in_admin_bar'     => true,
        'show_in_nav_menus'     => true,
        'can_export'            => true,
        'has_archive'           => true,
        'exclude_from_search'   => false,
        'publicly_queryable'    => true,
        'rewrite'               => $rewrite,
        'capability_type'       => 'post',
        'show_in_rest'          => true,
    );
    register_post_type('faculty', $args);
}
add_action('init', 'uiu_cpt_faculty', 0);

// Register Success Story Post Type
function uiu_cpt_story()
{

    $labels = array(
        'name'                  => 'Success Stories',
        'singular_name'         => 'Success Story',
        'menu_name'             => 'Success Stories',
        'name_admin_bar'        => 'Post Type',
        'archives'              => 'Success Story Archives',
        'attributes'            => 'Success Story Attributes',
        'parent_item_colon'     => 'Parent Story:',
        'all_items'             => 'All Stories',
        'add_new_item'          => 'Add New Story',
        'add_new'               => 'Add New',
        'new_item'              => 'New Story',
        'edit_item'             => 'Edit Story',
        'update_item'           => 'Update Story',
        'view_item'             => 'View Story',
        'view_items'            => 'View Stories',
        'search_items'          => 'Search Story',
        'featured_image'        => 'Cover Image',
        'set_featured_image'    => 'Set cover image',
        'remove_featured_image' => 'Remove cover image',
        'use_featured_image'    => 'Use as cover image',
        'insert_into_item'      => 'Insert into story',
        'uploaded_to_this_item' => 'Uploaded to this story',
        'items_list'            => 'Success Stories list',
        'items_list_navigation' => 'Success Stories list navigation',
        'filter_items_list'     => 'Filter storys list',
    );
    $rewrite = array(
        'slug'                  => 'success_story',
        'with_front'            => true,
        'pages'                 => true,
        'feeds'                 => true,
    );
    $args = array(
        'label'                 => 'Success Story',
        'description'           => 'Success Story of Department of CSE',
        'labels'                => $labels,
        'supports'              => array('title', 'editor', 'thumbnail', 'revisions'),
        // 'taxonomies'            => array('category', 'post_tag'),
        'hierarchical'          => false,
        'public'                => true,
        'show_ui'               => true,
        'show_in_menu'          => true,
        'menu_position'         => 12,
        'menu_icon'             => 'dashicons-businessperson',
        'show_in_admin_bar'     => true,
        'show_in_nav_menus'     => true,
        'can_export'            => true,
        'has_archive'           => true,
        'exclude_from_search'   => false,
        'publicly_queryable'    => true,
        'rewrite'               => $rewrite,
        'capability_type'       => 'post',
        'show_in_rest'          => true,
    );
    register_post_type('success_story', $args);
}
add_action('init', 'uiu_cpt_story', 0);


// Register Alumnus Post Type
function uiu_cpt_alumni()
{

    $labels = array(
        'name'                  => 'Alumni',
        'singular_name'         => 'Alumnus',
        'menu_name'             => 'Alumni',
        'name_admin_bar'        => 'Post Type',
        'archives'              => 'Alumnus Archives',
        'attributes'            => 'Alumnus Attributes',
        'parent_item_colon'     => 'Parent Alumnus:',
        'all_items'             => 'All Alumni',
        'add_new_item'          => 'Add New Alumnus',
        'add_new'               => 'Add New',
        'new_item'              => 'New Alumnus',
        'edit_item'             => 'Edit Alumnus',
        'update_item'           => 'Update Alumnus',
        'view_item'             => 'View Alumnus',
        'view_items'            => 'View Alumni',
        'search_items'          => 'Search Alumnus',
        'featured_image'        => 'Cover Image',
        'set_featured_image'    => 'Set cover image',
        'remove_featured_image' => 'Remove cover image',
        'use_featured_image'    => 'Use as cover image',
        'insert_into_item'      => 'Insert into alumnus',
        'uploaded_to_this_item' => 'Uploaded to this alumnus',
        'items_list'            => 'Alumni list',
        'items_list_navigation' => 'Alumni list navigation',
        'filter_items_list'     => 'Filter alumni list',
    );
    $rewrite = array(
        'slug'                  => 'alumni',
        'with_front'            => true,
        'pages'                 => true,
        'feeds'                 => true,
    );
    $args = array(
        'label'                 => 'Alumnus',
        'description'           => 'Alumnus of Department of CSE',
        'labels'                => $labels,
        'supports'              => array('title', 'editor', 'thumbnail', 'revisions'),
        // 'taxonomies'            => array('category', 'post_tag'),
        'hierarchical'          => false,
        'public'                => true,
        'show_ui'               => true,
        'show_in_menu'          => true,
        'menu_position'         => 13,
        'menu_icon'             => 'dashicons-businessperson',
        'show_in_admin_bar'     => true,
        'show_in_nav_menus'     => true,
        'can_export'            => true,
        'has_archive'           => true,
        'exclude_from_search'   => false,
        'publicly_queryable'    => true,
        'rewrite'               => $rewrite,
        'capability_type'       => 'post',
        'show_in_rest'          => true,
    );
    register_post_type('alumni', $args);
}
add_action('init', 'uiu_cpt_alumni', 0);


// Register Notice Post Type
function uiu_cpt_notice()
{

    $labels = array(
        'name'                  => 'Notices',
        'singular_name'         => 'Notice',
        'menu_name'             => 'Notices',
        'name_admin_bar'        => 'Post Type',
        'archives'              => 'Notice Archives',
        'attributes'            => 'Notice Attributes',
        'parent_item_colon'     => 'Parent Notice:',
        'all_items'             => 'All Notices',
        'add_new_item'          => 'Add New Notice',
        'add_new'               => 'Add New',
        'new_item'              => 'New Notice',
        'edit_item'             => 'Edit Notice',
        'update_item'           => 'Update Notice',
        'view_item'             => 'View Notice',
        'view_items'            => 'View Notices',
        'search_items'          => 'Search Notice',
        'insert_into_item'      => 'Insert into notice',
        'uploaded_to_this_item' => 'Uploaded to this notice',
        'items_list'            => 'Notices list',
        'items_list_navigation' => 'Notices list navigation',
        'filter_items_list'     => 'Filter notices list',
    );
    $rewrite = array(
        'slug'                  => 'notice',
        'with_front'            => true,
        'pages'                 => true,
        'feeds'                 => true,
    );
    $args = array(
        'label'                 => 'Notice',
        'description'           => 'Notice of Department of CSE',
        'labels'                => $labels,
        'supports'              => array('title', 'editor', 'thumbnail', 'revisions'),
        // 'taxonomies'            => array('category', 'post_tag'),
        'hierarchical'          => false,
        'public'                => true,
        'show_ui'               => true,
        'show_in_menu'          => true,
        'menu_position'         => 14,
        'menu_icon'             => 'dashicons-businessperson',
        'show_in_admin_bar'     => true,
        'show_in_nav_menus'     => true,
        'can_export'            => true,
        'has_archive'           => true,
        'exclude_from_search'   => false,
        'publicly_queryable'    => true,
        'rewrite'               => $rewrite,
        'capability_type'       => 'post',
        'show_in_rest'          => true,
    );
    register_post_type('notice', $args);
}
add_action('init', 'uiu_cpt_notice', 0);


// Register Event Post Type
function uiu_cpt_event()
{

    $labels = array(
        'name'                  => 'Events',
        'singular_name'         => 'Event',
        'menu_name'             => 'Events',
        'name_admin_bar'        => 'Post Type',
        'archives'              => 'Event Archives',
        'attributes'            => 'Event Attributes',
        'parent_item_colon'     => 'Parent Event:',
        'all_items'             => 'All Events',
        'add_new_item'          => 'Add New Event',
        'add_new'               => 'Add New',
        'new_item'              => 'New Event',
        'edit_item'             => 'Edit Event',
        'update_item'           => 'Update Event',
        'view_item'             => 'View Event',
        'view_items'            => 'View Events',
        'search_items'          => 'Search Event',
        'insert_into_item'      => 'Insert into event',
        'uploaded_to_this_item' => 'Uploaded to this event',
        'items_list'            => 'Events list',
        'items_list_navigation' => 'Events list navigation',
        'filter_items_list'     => 'Filter events list',
    );
    $rewrite = array(
        'slug'                  => 'event',
        'with_front'            => true,
        'pages'                 => true,
        'feeds'                 => true,
    );
    $args = array(
        'label'                 => 'Event',
        'description'           => 'Event of Department of CSE',
        'labels'                => $labels,
        'supports'              => array('title', 'editor', 'thumbnail', 'revisions'),
        // 'taxonomies'            => array('category', 'post_tag'),
        'hierarchical'          => false,
        'public'                => true,
        'show_ui'               => true,
        'show_in_menu'          => true,
        'menu_position'         => 15,
        'menu_icon'             => 'dashicons-businessperson',
        'show_in_admin_bar'     => true,
        'show_in_nav_menus'     => true,
        'can_export'            => true,
        'has_archive'           => true,
        'exclude_from_search'   => false,
        'publicly_queryable'    => true,
        'rewrite'               => $rewrite,
        'capability_type'       => 'post',
        'show_in_rest'          => true,
    );
    register_post_type('event', $args);
}
add_action('init', 'uiu_cpt_event', 0);



// Register News Post Type
function uiu_cpt_news()
{

    $labels = array(
        'name'                  => 'News',
        'singular_name'         => 'News',
        'menu_name'             => 'News',
        'name_admin_bar'        => 'Post Type',
        'archives'              => 'News Archives',
        'attributes'            => 'News Attributes',
        'parent_item_colon'     => 'Parent News:',
        'all_items'             => 'All News',
        'add_new_item'          => 'Add New News',
        'add_new'               => 'Add New',
        'new_item'              => 'New News',
        'edit_item'             => 'Edit News',
        'update_item'           => 'Update News',
        'view_item'             => 'View News',
        'view_items'            => 'View News',
        'search_items'          => 'Search News',
        'insert_into_item'      => 'Insert into news',
        'uploaded_to_this_item' => 'Uploaded to this news',
        'items_list'            => 'News list',
        'items_list_navigation' => 'News list navigation',
        'filter_items_list'     => 'Filter news list',
    );
    $rewrite = array(
        'slug'                  => 'news',
        'with_front'            => true,
        'pages'                 => true,
        'feeds'                 => true,
    );
    $args = array(
        'label'                 => 'News',
        'description'           => 'News of Department of CSE',
        'labels'                => $labels,
        'supports'              => array('title', 'editor', 'thumbnail', 'author', 'excerpt', 'revisions'),
        // 'taxonomies'            => array('category', 'post_tag'),
        'hierarchical'          => false,
        'public'                => true,
        'show_ui'               => true,
        'show_in_menu'          => true,
        'menu_position'         => 16,
        'menu_icon'             => 'dashicons-businessperson',
        'show_in_admin_bar'     => true,
        'show_in_nav_menus'     => true,
        'can_export'            => true,
        'has_archive'           => true,
        'exclude_from_search'   => false,
        'publicly_queryable'    => true,
        'rewrite'               => $rewrite,
        'capability_type'       => 'post',
        'show_in_rest'          => true,
    );
    register_post_type('news', $args);
}
add_action('init', 'uiu_cpt_news', 0);

// $existing_CPT_menu = 'edit.php?post_type=notice';
// $link_our_new_CPT = 'edit.php?post_type=news';

// add_submenu_page($existing_CPT_menu, 'SubmenuTitle', 'SubmenuTitle', 'manage_options', $link_our_new_CPT);

// // functions.php
// add_action('admin_menu', function () {
//     add_menu_page(
//         'Custom Admin Page',
//         'Custom Admin Page',
//         'manage_options',
//         'faculty',
//     );
// });
