<?php
function custom_post_types() {
    register_post_type('notice',
        array(
            'labels' => array(
                'name' => __('Notices'),
                'singular_name' => __('notice')
            ),
            'public' => true,
            'has_archive' => true,
            'rewrite' => array('slug' => 'notice'),
            'supports' => array('title','editor', 'thumbnail')
        )
    );
    register_post_type('download',
        array(
            'labels' => array(
                'name' => __('Download'),
                'singular_name' => __('download')
            ),
            'public' => true,
            'has_archive' => true,
            'rewrite' => array('slug' => 'download'),
            'supports' => array('title','editor')
        )
    );
    // Register Faculty Post Type
    register_post_type('faculty', array(
        'labels' => array(
            'name' => 'Department',
            'singular_name' => 'Department',
        ),
        'public' => true,
        'has_archive' => true,
        'supports' => array('title', 'editor', 'thumbnail'),
        'show_in_rest' => true,
    ));

    // Register Department Post Type
    /*register_post_type('department', array(
        'labels' => array(
            'name' => 'Subject',
            'singular_name' => 'Subject',
        ),
        'public' => true,
        'has_archive' => true,
        'supports' => array('title', 'editor', 'thumbnail'),
        'show_in_rest' => true,
    ));*/

    // Register Department Post Type
    register_post_type('dept_member', array(
        'labels' => array(
            'name' => 'Subject Wise Member',
            'singular_name' => 'Subject Wise Member',
        ),
        'public' => true,
        'has_archive' => true,
        'supports' => array('title', 'editor', 'thumbnail'),
        'show_in_rest' => true,
    ));
    // Register Department Post Type
    register_post_type('lab', array(
        'labels' => array(
            'name' => 'Laboratory',
            'singular_name' => 'Laboratory',
        ),
        'public' => true,
        'has_archive' => true,
        'supports' => array('title', 'editor', 'thumbnail'),
        'show_in_rest' => true,
    ));
    // Register Department Post Type
    register_post_type('admissions', array(
        'labels' => array(
            'name' => 'Admissions',
            'singular_name' => 'Admissions',
        ),
        'public' => true,
        'has_archive' => true,
        'supports' => array('title',),
        'show_in_rest' => true,
    ));
    // Register stuff Post Type
    register_post_type('staff', array(
        'labels' => array(
            'name' => 'Staff',
            'singular_name' => 'staff',
        ),
        'public' => true,
        'has_archive' => true,
        'supports' => array('title',),
        'show_in_rest' => true,
    ));
    // Register Club Post Type
    register_post_type('club', array(
        'labels' => array(
            'name' => 'Clubs',
            'singular_name' => 'club',
        ),
        'public' => true,
        'has_archive' => true,
        'supports' => array('title', 'editor'),
        'show_in_rest' => true,
    ));
    // Register Gbody Post Type
    register_post_type('gbody', array(
        'labels' => array(
            'name' => 'Governing Body',
            'singular_name' => 'gbody',
        ),
        'public' => true,
        'has_archive' => true,
        'supports' => array('title'),
        'show_in_rest' => true,
    ));
}
add_action('init', 'custom_post_types');

/*function register_faculty_department_taxonomy() {

    register_taxonomy('faculty_category', array('department','notice','lab','dept_member'), array(
        'label' => 'Department Type',
        'rewrite' => array('slug' => 'faculty_category'),
        'hierarchical' => true,
        'show_in_rest' => true,
    ));
}
add_action('init', 'register_faculty_department_taxonomy');
function pll_register_string_faculty_category() {
    pll_register_string('faculty_category', 'faculty_category-tax', 'Taxonomy Slug');
}
add_action('pll_init', 'pll_register_string_faculty_category');*/

function register_department_member_taxonomy() {

    register_taxonomy('department_category', array('notice', 'department','dept_member','faculty'), array(
        'label' => 'Subject Type',
        'rewrite' => array('slug' => 'department_category'),
        'hierarchical' => true,
        'show_in_rest' => true,
    ));
}
add_action('init', 'register_department_member_taxonomy');
function pll_register_string_department_member() {
    pll_register_string('department_member', 'department_member-tax', 'Taxonomy Slug');
}
add_action('pll_init', 'pll_register_string_department_member');
function register_member_taxonomy() {

    register_taxonomy('member_category', array('dept_member'), array(
        'label' => 'Member Type',
        'rewrite' => array('slug' => 'member_category'),
        'hierarchical' => true,
        'show_in_rest' => true,
    ));
}
add_action('init', 'register_member_taxonomy');
function pll_register_string_member() {
    pll_register_string('member', 'member-tax', 'Taxonomy Slug');
}
add_action('pll_init', 'pll_register_string_member');
?>
