<?php

add_action( 'init', 'create_post_type_courses', 0 );
function create_post_type_courses() {
 
    $labels = array(
        'name'                => _x( 'Courses', 'Post Type General Name', 'felicityhealth' ),
        'singular_name'       => _x( 'Course', 'Post Type Singular Name', 'felicityhealth' ),
        'menu_name'           => __( 'Courses', 'felicityhealth' ),
        'parent_item_colon'   => __( 'Parent Course:', 'felicityhealth' ),
        'all_items'           => __( 'All Course', 'felicityhealth' ),
        'view_item'           => __( 'View Course', 'felicityhealth' ),
        'add_new_item'        => __( 'Add New Course', 'felicityhealth' ),
        'add_new'             => __( 'Add New Course', 'felicityhealth' ),
        'edit_item'           => __( 'Edit Course', 'felicityhealth' ),
        'update_item'         => __( 'Update Course', 'felicityhealth' ),
        'search_items'        => __( 'Search Course', 'felicityhealth' ),
        'not_found'           => __( 'No casts found', 'felicityhealth' ),
        'not_found_in_trash'  => __( 'No casts found in trash', 'felicityhealth' ),
    );
    $args = array(
        'label'               => __( 'Courses', 'felicityhealth' ),
        'description'         => __( 'Courses Description', 'felicityhealth' ),
        'labels'              => $labels,
        'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', 'permalinks', 'featured_image' ),
        'show_in_rest'        => true,
        // 'taxonomies'          => array( 'category' ),
        'hierarchical'        => false,
        'public'              => true,
        'show_ui'             => true,
        'show_in_menu'        => true,
        'show_in_nav_menus'   => true,
        'show_in_admin_bar'   => true,
        'menu_position'       => 5,
        'menu_icon'           => 'dashicons-welcome-learn-more',
        'can_export'          => true,
        'has_archive'         => true,
        'exclude_from_search' => false,
        'publicly_queryable'  => true,
        'capability_type'     => 'page'

    );
    register_post_type( 'Courses', $args );
}

    // Courses categories
    add_action( 'init', 'register_taxonomy_course_category', 0 );

    function register_taxonomy_course_category() {

        $labels = array(
            // See list of labels in docs I linked above (bold and blue "here")     
        );
        $args = array(  

            // Custom labels? Remove them all to get "default"
            'labels'              => $labels,
            // Does these have child-parent relationships?
            'hierarchical'        => true,
            // Translatable pretty slugs?
            'rewrite'             => array( 'slug' => __( 'course-category', 'course' ) ),
            // Generate a default UI for managing this taxonomy?
            'show_ui'             => true,
            // Allow automatic creation of taxonomy columns on associated post-types table?
            'show_admin_column'   => true,
            // Show in quick edit panel?
            'show_in_quick_edit'  => true,
            'show_in_rest'        => true,
        );

        register_taxonomy( 'course-category', 'courses', $args );
    }
