<?php
/**
* Create custom post types.
 * https://wp-kama.ru/function/register_post_type
 * https://wp-kama.ru/function/register_taxonomy
 *
*/

/***********************************************************************************************/
/* Case Studies Custom Post Type */
/***********************************************************************************************/

// Register Custom Post Type
function case_studies_posts() {

    $labels = array(
        'name'                => _x( 'Case Studies', 'Post Type General Name', 'text_domain' ),
        'singular_name'       => _x( 'Case Study', 'Post Type Singular Name', 'text_domain' ),
        'menu_name'           => __( 'Case Studies', 'text_domain' ),
        'parent_item_colon'   => __( 'Parent Case Study:', 'text_domain' ),
        'all_items'           => __( 'All Case Studies', 'text_domain' ),
        'view_item'           => __( 'View Case Study', 'text_domain' ),
        'add_new_item'        => __( 'Add New Case Study', 'text_domain' ),
        'add_new'             => __( 'Add New', 'text_domain' ),
        'edit_item'           => __( 'Edit Case Study', 'text_domain' ),
        'update_item'         => __( 'Update Case Study', 'text_domain' ),
        'search_items'        => __( 'Search Case Studies', 'text_domain' ),
        'not_found'           => __( 'Not found', 'text_domain' ),
        'not_found_in_trash'  => __( 'Not found in Trash', 'text_domain' ),
    );

    $args = array(
        'label'               => __( 'case_studies', 'text_domain' ),
        'description'         => __( 'Post Type Description', 'text_domain' ),
        'labels'              => $labels,
        'supports'            => array( 'title', 'thumbnail', 'editor', 'revisions', 'excerpt', 'page-attributes' ),
        'taxonomies'          => array('expertise', 'cross_categories'),
        'hierarchical'        => true,
        'public'              => true,
        'show_ui'             => true,
        'show_in_menu'        => true,
        'show_in_nav_menus'   => true,
        'show_in_admin_bar'   => true,
        'rewrite'            => array( 'slug' => 'case-studies' ),
        'menu_position'       => 20,
        'menu_icon'			  => 'dashicons-exerpt-view',
        'has_archive'         => false,
        'exclude_from_search' => false,
        'publicly_queryable'  => true,
        'capability_type' => 'post',
    );
    register_post_type( 'case_studies', $args );
}

// Hook into the 'init' action
add_action( 'init', 'case_studies_posts', 0 );

//// Register Custom Taxonomy
//function case_studies_cat() {
//
//    $labels = array(
//        'name'                       => _x( 'Category', 'Taxonomy General Name', 'text_domain' ),
//        'singular_name'              => _x( 'Category', 'Taxonomy Singular Name', 'text_domain' ),
//        'menu_name'                  => __( 'Category', 'text_domain' ),
//        'all_items'                  => __( 'All Category', 'text_domain' ),
//        'parent_item'                => __( 'Parent Category', 'text_domain' ),
//        'parent_item_colon'          => __( 'Parent Category:', 'text_domain' ),
//        'new_item_name'              => __( 'New Category', 'text_domain' ),
//        'add_new_item'               => __( 'Add New Category', 'text_domain' ),
//        'edit_item'                  => __( 'Edit Category', 'text_domain' ),
//        'update_item'                => __( 'Update Category', 'text_domain' ),
//        'separate_items_with_commas' => __( 'Separate Category with commas', 'text_domain' ),
//        'search_items'               => __( 'Search Category', 'text_domain' ),
//        'add_or_remove_items'        => __( 'Add or remove Category', 'text_domain' ),
//        'choose_from_most_used'      => __( 'Choose from the most used Category', 'text_domain' ),
//        'not_found'                  => __( 'Not Found', 'text_domain' ),
//    );
//    $args = array(
//        'labels'                     => $labels,
//        'hierarchical'               => true,
//        'public'                     => true,
//        'show_ui'                    => true,
//        'show_admin_column'          => true,
//        'show_in_nav_menus'          => true,
//        'show_tagcloud'              => true,
//    );
//    register_taxonomy( 'case_studies_cat', array( 'case_studies' ), $args );
//
//}
//// Hook into the 'init' action
//add_action( 'init', 'case_studies_cat', 0 );

/***********************************************************************************************/
/* Clients Custom Post Type */
/***********************************************************************************************/

// Register Custom Post Type
function dm_register_brands() {

    $labels = array(
        'name'                => _x( 'Brands', 'Post Type General Name', 'text_domain' ),
        'singular_name'       => _x( 'Brand', 'Post Type Singular Name', 'text_domain' ),
        'menu_name'           => __( 'Brands', 'text_domain' ),
        'parent_item_colon'   => __( 'Parent Brand:', 'text_domain' ),
        'all_items'           => __( 'All Brands', 'text_domain' ),
        'view_item'           => __( 'View Brand', 'text_domain' ),
        'add_new_item'        => __( 'Add New Brand', 'text_domain' ),
        'add_new'             => __( 'Add New', 'text_domain' ),
        'edit_item'           => __( 'Edit Brand', 'text_domain' ),
        'update_item'         => __( 'Update Brand', 'text_domain' ),
        'search_items'        => __( 'Search Brands', 'text_domain' ),
        'not_found'           => __( 'Not found', 'text_domain' ),
        'not_found_in_trash'  => __( 'Not found in Trash', 'text_domain' ),
    );

    $args = array(
        'label'               => __( 'brands', 'text_domain' ),
        'description'         => __( 'Post Type Description', 'text_domain' ),
        'labels'              => $labels,
        'supports'            => array( 'title', 'thumbnail','revisions', 'excerpt', 'page-attributes' ),
        'taxonomies'          => array(),
        'hierarchical'        => true,
        'public'              => true,
        'show_ui'             => true,
        'show_in_menu'        => true,
        'show_in_nav_menus'   => true,
        'show_in_admin_bar'   => true,
        'menu_position'       => 18,
        'menu_icon'			  => 'dashicons-schedule',
        'can_export'		  => true,
        'has_archive'         => false,
        'exclude_from_search' => false,
        'publicly_queryable'  => false,
        'capability_type' => 'post',
    );
    register_post_type( 'brands', $args );

}

// Hook into the 'init' action
add_action( 'init', 'dm_register_brands', 0 );


/***********************************************************************************************/
/* Team Custom Post Type */
/***********************************************************************************************/

// Register Custom Post Type
function dm_register_team() {

    $labels = array(
        'name'                => _x( 'Team', 'Post Type General Name', 'text_domain' ),
        'singular_name'       => _x( 'Team', 'Post Type Singular Name', 'text_domain' ),
        'menu_name'           => __( 'Team', 'text_domain' ),
        'parent_item_colon'   => __( 'Parent Item:', 'text_domain' ),
        'all_items'           => __( 'All Team', 'text_domain' ),
        'view_item'           => __( 'View Person', 'text_domain' ),
        'add_new_item'        => __( 'Add New Person', 'text_domain' ),
        'add_new'             => __( 'Add New', 'text_domain' ),
        'edit_item'           => __( 'Edit Person', 'text_domain' ),
        'update_item'         => __( 'Update Person', 'text_domain' ),
        'search_items'        => __( 'Search Team', 'text_domain' ),
        'not_found'           => __( 'Not found', 'text_domain' ),
        'not_found_in_trash'  => __( 'Not found in Trash', 'text_domain' ),
    );

    $args = array(
        'label'               => __( 'team', 'text_domain' ),
        'description'         => __( 'Post Type Description', 'text_domain' ),
        'labels'              => $labels,
        'supports'            => array( 'title', 'thumbnail', 'page-attributes' ),
        'taxonomies'          => array(),
        'hierarchical'        => true,
        'public'              => true,
        'show_ui'             => true,
        'show_in_menu'        => true,
        'show_in_nav_menus'   => true,
        'show_in_admin_bar'   => true,
        'menu_icon'			  => 'dashicons-admin-users',
        'can_export'		  => true,
        'has_archive'         => false,
        'exclude_from_search' => false,
        'publicly_queryable'  => false,
        'capability_type' => 'post',
    );
    register_post_type( 'team', $args );

}

// Hook into the 'init' action
add_action( 'init', 'dm_register_team', 0 );

// Register Custom Taxonomy
function team_cat() {

    $labels = array(
        'name'                       => _x( 'Department', 'Taxonomy General Name', 'text_domain' ),
        'singular_name'              => _x( 'Department', 'Taxonomy Singular Name', 'text_domain' ),
        'menu_name'                  => __( 'Department', 'text_domain' ),
        'all_items'                  => __( 'All Departments', 'text_domain' ),
        'parent_item'                => __( 'Parent Department', 'text_domain' ),
        'parent_item_colon'          => __( 'Parent Department:', 'text_domain' ),
        'new_item_name'              => __( 'New Department', 'text_domain' ),
        'add_new_item'               => __( 'Add New Department', 'text_domain' ),
        'edit_item'                  => __( 'Edit Department', 'text_domain' ),
        'update_item'                => __( 'Update Department', 'text_domain' ),
        'separate_items_with_commas' => __( 'Separate Department with commas', 'text_domain' ),
        'search_items'               => __( 'Search Department', 'text_domain' ),
        'add_or_remove_items'        => __( 'Add or remove Department', 'text_domain' ),
        'choose_from_most_used'      => __( 'Choose from the most used Department', 'text_domain' ),
        'not_found'                  => __( 'Not Found', 'text_domain' ),
    );
    $args = array(
        'labels'                     => $labels,
        'hierarchical'               => true,
        'public'                     => true,
        'show_ui'                    => true,
        'show_admin_column'          => true,
        'show_in_nav_menus'          => true,
        'show_tagcloud'              => true,
    );
    register_taxonomy( 'department', array( 'team' ), $args );

}
// Hook into the 'init' action
add_action( 'init', 'team_cat', 0 );
