<?php

add_action( 'after_setup_theme', 'klasik_setup' );

if ( ! function_exists( 'klasik_setup' ) ):

function klasik_setup() {

	// This theme styles the visual editor with editor-style.css to match the theme style.
	add_editor_style();

	// This theme uses post thumbnails
	if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9
		add_theme_support( 'post-thumbnails' );
		add_image_size( 'image-slider', 980, 380, true ); // Slider
		add_image_size( 'thumb-blog', 340, 266, true ); // Blog Image
		add_image_size( 'thumb-recentpost', 94, 70, true ); // Recent Post Widget Image
		add_image_size( 'thumb-portfolio', 340, 266, true );
	}

	// Add default posts and comments RSS feed links to head
	add_theme_support( 'automatic-feed-links' );

	// This theme uses wp_nav_menu() in one location.
	register_nav_menus( array(
		'mainmenu' => __( 'Main Menu', 'klasik' )

	) );
}
endif;

if ( ! function_exists( 'klasik_theme_support' ) ):

function klasik_theme_support() {
	$args = "";
	 add_theme_support( 'custom-header', $args );
	 add_theme_support( 'custom-background', $args );
}
endif;

/*================Portfolio Post Type================*/
function klasik_post_type_portfolio() {
	register_post_type( 'pdetail',
                array( 
				'labels' => array(
						'name' => __('Portfolio', 'klasik'),
						'add_new_item' => __('Add New Portfolio Item', 'klasik'),
						'edit_item' => __('Edit Portfolio Item', 'klasik'),
						'new_item' => __('New Portfolio Item', 'klasik')
						), 
				'public' => true, 
				'show_ui' => true,
				'show_in_nav_menus' => true,
				'rewrite' => array( 'slug' => 'pdetail', 'with_front' => false ),
				'hierarchical' => true,
				'menu_position' => 5,
				'has_archive' => true,
				'supports' => array(
						 'title',
						 'editor',
						 'custom-fields',
						 'thumbnail',
						 'revisions',
						 'excerpt')
					) 
				);
				
	register_taxonomy( 'portfolio-category', array( 'pdetail' ), array(
		'hierarchical' => true,
		'label' =>  __('Portfolio Categories', 'klasik'),
		'query_var' => true,
		'rewrite' => array( 'slug' => 'portfolio-category', 'with_front' => false ),
		'show_ui' => true,
	));
}

add_action('init', 'klasik_post_type_portfolio');


/*================Slider Post Type================*/
function klasik_post_type_slider() {
	register_post_type( 'slider',
                array( 
				'labels' => array(
						'name' => __('Slider', 'klasik'),
						'add_new_item' => __('Add New Slider Item', 'klasik'),
						'edit_item' => __('Edit Slider Item', 'klasik'),
						'new_item' => __('New Slider Item', 'klasik')
						), 
				'public' => true, 
				'show_ui' => true,
				'show_in_nav_menus' => false,
				'rewrite' => true,
				'hierarchical' => true,
				'menu_position' => 5,
				'exclude_from_search' =>true,
				'supports' => array(
				                     'title',
									 'custom-fields',
                                     'thumbnail',
									 'excerpt')
					) 
				);
	
	register_taxonomy( 'slider-category', array( 'slider' ), array(
		'hierarchical' => true,
		'label' =>  __('Slider Categories', 'klasik'),
		'query_var' => true,
		'rewrite' => array( 'slug' => 'slider-category', 'with_front' => false ),
		'show_ui' => true,
	));
}

add_action('init', 'klasik_post_type_slider');