<?php

// Prevent Direct Access
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

// Register 'portfolio' post type
function maxo_portfolio_register() {

	// Labels
	$labels = array(
		'name'               => esc_html__('Portfolios', 'maxo-fa'),
		'singular_name'      => esc_html__('Portfolio', 'maxo-fa'),
		'menu_name'          => esc_html__('Portfolios', 'maxo-fa'),
		'add_new'            => esc_html__('Add New Portfolio', 'maxo-fa'),
		'add_new_item'       => esc_html__('Add New Portfolio', 'maxo-fa'),
		'edit_item'          => esc_html__('Edit Portfolio', 'maxo-fa'),
		'new_item'           => esc_html__('New Portfolio', 'maxo-fa'),
		'view_item'          => esc_html__('View Portfolio', 'maxo-fa'),
		'search_items'       => esc_html__('Search Portfolios', 'maxo-fa'),
		'not_found'          => esc_html__('Nothing Found', 'maxo-fa'),
		'not_found_in_trash' => esc_html__('Nothing Found in Trash', 'maxo-fa'),
		'parent_item_colon'  => esc_html__('Parent Item:', 'maxo-fa'),
	);

	// Register 'portfolio' post type
	register_post_type('portfolio', array(
		'labels' => $labels,
		'public' => true,
		'exclude_from_search' => true,
		'show_in_nav_menus'   => false,
		'menu_position' => null,
		'menu_icon' => 'dashicons-images-alt2',
		'supports' => array('title','thumbnail')
	));
}

add_action('init', 'maxo_portfolio_register');

// Register portfolio categories taxonomy
function maxo_portfolio_taxonomy() {

	// Labels
	$labels = array(
		'name'              => esc_html__('Portfolios Categories', 'maxo-fa'),
		'singular_name'     => esc_html__('Portfolio Category', 'maxo-fa'),
		'search_items'      => esc_html__('Search Portfolios Categories', 'maxo-fa'),
		'all_items'         => esc_html__('All Portfolios Categories', 'maxo-fa'),
		'parent_item'       => esc_html__('Parent Portfolio Category', 'maxo-fa'),
		'parent_item_colon' => esc_html__('Parent Portfolio Category:', 'maxo-fa'),
		'edit_item'         => esc_html__('Edit Portfolio Category', 'maxo-fa'),
		'update_item'       => esc_html__('Update Portfolio Category', 'maxo-fa'),
		'add_new_item'      => esc_html__('Add New Portfolio Category', 'maxo-fa'),
		'new_item_name'     => esc_html__('New Portfolio Category Name', 'maxo-fa'),
	);

	// Register and attach to 'portfolio' post type
	register_taxonomy('portfolio_categories', 'portfolio', array(
		'labels' => $labels,
		'public' => true,
		'show_in_nav_menus' => false,
		'hierarchical' => true
	));
}

add_action('init', 'maxo_portfolio_taxonomy');
