<?php
if ( ! function_exists( 'xs_schedule' ) ) {

// Register Custom Taxonomy
function xs_schedules() {

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

}

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

}


if ( ! function_exists('xs_post_type_schedule') ) {

// Register Custom Post Type
function xs_post_type_schedule() {

	$labels = array(
		'name'                => _x( 'Schedules', 'Post Type General Name', 'xs' ),
		'singular_name'       => _x( 'Schedule', 'Post Type Singular Name', 'xs' ),
		'menu_name'           => __( 'onEvent', 'xs' ),
		'parent_item_colon'   => __( 'Parent Schedule:', 'xs' ),
		'all_items'           => __( 'All Schedules', 'xs' ),
		'view_item'           => __( 'View Schedule', 'xs' ),
		'add_new_item'        => __( 'Add New Schedule', 'xs' ),
		'add_new'             => __( 'Add Schedule', 'xs' ),
		'edit_item'           => __( 'Change Schedule', 'xs' ),
		'update_item'         => __( 'Update Schedule', 'xs' ),
		'search_items'        => __( 'Search Schedule', 'xs' ),
		'not_found'           => __( 'Not found', 'xs' ),
		'not_found_in_trash'  => __( 'Not found in Trash', 'xs' ),
	);
	$args = array(
		'label'               => __( 'xs_schedule', 'xs' ),
		'description'         => __( 'onEvent Settings', 'xs' ),
		'labels'              => $labels,
		'supports'            => array( 'title', 'page-attributes', 'editor' ),
		'taxonomies'          => array( 'xs_schedules' ),
		'hierarchical'        => false,
		'public'              => false,
		'show_ui'             => true,
		'show_in_menu'        => true,
		'show_in_nav_menus'   => false,
		'show_in_admin_bar'   => true,
		'menu_position'       => 5,
		'can_export'          => true,
		'has_archive'         => true,
		'exclude_from_search' => true,
		'publicly_queryable'  => true,
		'capability_type'     => 'page',
	);
	register_post_type( 'xs_schedule', $args );

}

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

}