<?php
if ( function_exists( 'add_theme_support' ) ) {
	add_theme_support( 'post-thumbnails', array('post', 'portfolio_item', 'page') );
	add_image_size( 'small-thumbnail', 80, 50, true );
	add_image_size( 'single-view-thumbnail', 285, 185, true );
	add_image_size( 'single-view-thumbnail-wide', 794, 350, true );
	add_image_size( 'portfolio-thumbnail', 220, 160, true );
	add_image_size( 'home-slider-image', 1080, 450, true );
}

add_action( 'init', 'create_my_post_types' );
function create_my_post_types() {
	register_post_type( 'portfolio_item',
		array(
			'labels' => array(
				'name' => __( 'Portfolio Items' ),
				'singular_name' => __( 'Portfolio item' ),
				'add_new_item' => __('Add new Portfolio item'),
				'edit_item' => __('Edit Portfolio item'),
				'view_item' => __('View Portfolio item'),
				'search_items' => __('Search Portfolio items'),
				'not_found' => __('No Portfolio items found'),
				'not_found_in_trash' => __('No Portfolio items found in Trash'),
			),
			'public' => true,
			'show_in_nav_menus' => true,
			'menu_position' => 5,
			'supports' => array('title', 'editor', 'comments', 'excerpt', 'thumbnail'),
			'rewrite' => array( 'slug' => 'portfolio-item', 'with_front' => false ),
		)
	);
}

add_action( 'init', 'register_my_taxonomies', 0 );
function register_my_taxonomies() {
	register_taxonomy(
		'portfolio_category',
		array( 'portfolio_item' ),
		array(
			'public' => true,
			'labels' => array(
				'name' => __( 'Portfolio Categories' ),
				'singular_name' => __( 'Portfolio Category' )
			),
			'hierarchical' => true,
			'rewrite' => array( 'slug' => 'category/portfolio', 'with_front' => false ),
		)
	);
	
	register_taxonomy(
		'portfolio_tags',
		array( 'portfolio_item' ),
		array(
			'public' => true,
			'labels' => array(
				'name' => __( 'Portfolio Tags' ),
				'singular_name' => __( 'Portfolio Tag' )
			),
			'hierarchical' => false,
			'rewrite' => array( 'slug' => 'tag/portfolio', 'with_front' => false ),
		)
	);
}

add_action( 'init', 'register_my_menu' );

function register_my_menu() {
	register_nav_menu( 'primary-menu', __( 'Primary Menu' ) );
}
?>