<?php
/*
Plugin Name: Register Custom Post Types and Taxonomies
Plugin URI: https://patelmilap.wordpress.com/
Description: This widget Register Custom Post Types and Taxonomies for Feathery theme.
Author: Milap Patel
Version: 0.1
Author URI: https://patelmilap.wordpress.com/
*/

function wr_feathery_fields() {

  $labels1 = array(
    'name' => _x('features', 'Post Type General Name', 'feathery'),
    'singular_name' => _x('feature', 'Post Type Singular Name', 'feathery'),
    'menu_name' => __('Features', 'feathery'),
    'parent_item_colon' => __('Parent feature:', 'feathery'),
    'all_items' => __('All features', 'feathery'),
    'view_item' => __('View feature', 'feathery'),
    'add_new_item' => __('Add New feature', 'feathery'),
    'add_new' => __('New feature', 'feathery'),
    'edit_item' => __('Edit feature', 'feathery'),
    'update_item' => __('Update feature', 'feathery'),
    'search_items' => __('Search feature', 'feathery'),
    'not_found' => __('No feature found', 'feathery'),
    'not_found_in_trash' => __('No features found in Trash', 'feathery'),
  );
  $args1 = array(
    'label' => __('feature', 'feathery'),
    'description' => __('feature', 'feathery'),
    'labels' => $labels1,
    'supports' => array('title'),
    'hierarchical' => false,
    'public' => true,
    'show_ui' => true,
    'show_in_menu' => true,
    'show_in_nav_menus' => true,
    'show_in_admin_bar' => true,
    'menu_position' => 5,
    'menu_icon' => 'dashicons-image-flip-vertical',
    'can_export' => true,
    'has_archive' => true,
    'exclude_from_search' => false,
    'publicly_queryable' => true,
    'capability_type' => 'page',
  );
  register_post_type('feathery_feature', $args1);

  // Testimonial Section

  $labels4 = array(
    'name' => _x('Testimonials', 'Post Type General Name', 'feathery'),
    'singular_name' => _x('Testimonial', 'Post Type Singular Name', 'feathery'),
    'menu_name' => __('Testimonials', 'feathery'),
    'parent_item_colon' => __('Parent Testimonial:', 'feathery'),
    'all_items' => __('All Testimonials', 'feathery'),
    'view_item' => __('View Testimonial', 'feathery'),
    'add_new_item' => __('Add New Testimonial', 'feathery'),
    'add_new' => __('New Testimonial', 'feathery'),
    'edit_item' => __('Edit Testimonial', 'feathery'),
    'update_item' => __('Update Testimonial', 'feathery'),
    'search_items' => __('Search Testimonials', 'feathery'),
    'not_found' => __('No testimonial found', 'feathery'),
    'not_found_in_trash' => __('No testimonials found in Trash', 'feathery'),
  );
  $args4 = array(
    'label' => __('Testimonial', 'feathery'),
    'description' => __('Testimonial', 'feathery'),
    'labels' => $labels4,
    'supports' => array('title'),
    'hierarchical' => false,
    'public' => true,
    'show_ui' => true,
    'show_in_menu' => true,
    'show_in_nav_menus' => true,
    'show_in_admin_bar' => true,
    'menu_position' => 5,
    'menu_icon' => 'dashicons-testimonial',
    'can_export' => true,
    'has_archive' => true,
    'exclude_from_search' => false,
    'publicly_queryable' => true,
    'capability_type' => 'page',
  );
  register_post_type('feathery_testimonial', $args4);

  // Team section
  $labels1 = array(
    'name' => _x('Team', 'Post Type General Name', 'feathery'),
    'singular_name' => _x('team', 'Post Type Singular Name', 'feathery'),
    'menu_name' => __('Team', 'feathery'),
    'parent_item_colon' => __('Parent team:', 'feathery'),
    'all_items' => __('All Team', 'feathery'),
    'view_item' => __('View Team', 'feathery'),
    'add_new_item' => __('Add New Team', 'feathery'),
    'add_new' => __('Add New', 'feathery'),
    'edit_item' => __('Edit Team Member', 'feathery'),
    'update_item' => __('Update Team Member', 'feathery'),
    'search_items' => __('Search Team Member', 'feathery'),
    'not_found' => __('No Team Found', 'feathery'),
    'not_found_in_trash' => __('No Team Found In Trash', 'feathery'),
  );
  $args1 = array(
    'label' => __('Team', 'feathery'),
    'description' => __('Team', 'feathery'),
    'labels' => $labels1,
    'supports' => array('title'),
    'hierarchical' => false,
    'public' => true,
    'show_ui' => true,
    'show_in_menu' => true,
    'show_in_nav_menus' => true,
    'show_in_admin_bar' => true,
    'menu_position' => 5,
    'menu_icon' => 'dashicons-groups',
    'can_export' => true,
    'has_archive' => true,
    'exclude_from_search' => false,
    'publicly_queryable' => true,
    'capability_type' => 'page',
  );
  register_post_type('feathery_team', $args1);


  // Portfolio Custom Field

  $labels2 = array(
    'name' => _x('Porftolio', 'Post Type General Name', 'feathery'),
    'singular_name' => _x('Portfolio', 'Post Type Singular Name', 'feathery'),
    'menu_name' => __('Porftolio', 'feathery'),
    'parent_item_colon' => __('Parent Portfolio:', 'feathery'),
    'all_items' => __('All Porftolio', 'feathery'),
    'view_item' => __('View Portfolio', 'feathery'),
    'add_new_item' => __('Add New Portfolio', 'feathery'),
    'add_new' => __('Add New', 'feathery'),
    'edit_item' => __('Edit Portfolio', 'feathery'),
    'update_item' => __('Update Portfolio', 'feathery'),
    'search_items' => __('Search Porftolio', 'feathery'),
    'not_found' => __('No Portfolio found', 'feathery'),
    'not_found_in_trash' => __('No Porftolio found in Trash', 'feathery'),
  );
  $args2 = array(
    'label' => __('Portfolio', 'feathery'),
    'description' => __('Portfolio', 'feathery'),
    'labels' => $labels2,
    'supports' => array('title'),
    'hierarchical' => false,
    'public' => true,
    'show_ui' => true,
    'show_in_menu' => true,
    'show_in_nav_menus' => true,
    'show_in_admin_bar' => true,
    'menu_position' => 5,
    'menu_icon' => 'dashicons-portfolio',
    'can_export' => true,
    'has_archive' => true,
    'exclude_from_search' => false,
    'publicly_queryable' => true,
    'capability_type' => 'page',
  );
  register_post_type('feathery_portfolio', $args2);
}

function register_portfolio_taxonomy() {
  $labels = array(
    'name' => __('Categories', 'feathery'),
    'singular_name' => __('Category', 'feathery'),
    'search_items' => __('Search Categories', 'feathery'),
    'popular_items' => __('Popular Categories', 'feathery'),
    'all_items' => __('All Categories', 'feathery'),
    'parent_item' => __('Parent Category', 'feathery'),
    'parent_item_colon' => __('Parent Category:', 'feathery'),
    'edit_item' => __('Edit Category', 'feathery'),
    'update_item' => __('Update Category', 'feathery'),
    'add_new_item' => __('Add New Category', 'feathery'),
    'new_item_name' => __('New Category', 'feathery'),
    'separate_items_with_commas' => __('Separate Categories with commas', 'feathery'),
    'add_or_remove_items' => __('Add or remove Categories', 'feathery'),
    'choose_from_most_used' => __('Choose from the most used Categories', 'feathery'),
    'menu_name' => __('Categories', 'feathery'),
  );

  $args = array(
    'labels' => $labels,
    'public' => true,
    'show_in_nav_menus' => false,
    'show_ui' => true,
    'show_tagcloud' => false,
    'hierarchical' => true,
    'rewrite' => true,
    'query_var' => true
  );

  register_taxonomy('categories', array('feathery_portfolio'), $args);
}