<?php
/**
 * Register New Post Type
 * @link https://codex.wordpress.org/Function_Reference/register_post_type
 * @copyright   Copyright (c) 2016
 * @since       1.0
 * @todo Replace only if your creating your own Plugin
 * @todo dst - Find all and replace text
 * @todo DST - Find all and replace text
 * @todo dealer - Find all and replace text
 * @todo Dealer
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;

/**
 * Custom Post Type Function
 * @since       1.0.0
 * @return void
 */
function dst_custom_post_type(){
    
    /**
     * CPT Labels
     * @since       1.0.0
    */
  $labels = array(
              'name'              => _x('Dealers','dst-txt'),
              'singular_name'     => _x('Dealer','dst-txt'),
              'menu_name'         => _x('Dealers','dst-txt'),
              'name_admin_bar'    => _x('Dealers', 'add dealers on admin bar', 'dst-txt' ),
              'add_new'           => _x('Add New','dst-txt'),
              'add_new_item'      => __('Add New Dealer','dst-txt'),
              'edit_item'         => __('Edit Dealer','dst-txt'),
              'new_item'          => __('New Dealer','dst-txt'),
              'all_items'         => __('Dealers','dst-txt'),
              'view_item'         => __('View Dealers','dst-txt'),
              'search_items'      => __('Search Dealers','dst-txt'),
              'parent_item_colon' => __('Parent Dealers:','dst-txt'),
              'not_found'         => __('No Dealers found','dst-txt'),
              'not_found_in_trash'=> __('No Dealers found in Trash','dst-txt'),       
    );
    
  /**
   * CPT Arguments
   */
  $args = array(
            'labels'              => $labels,
            'description'         => __( 'Description for Dealers', 'dst-txt' ),
            'public'              => true,
            'publicly_queryable'  => true,
            'show_ui'             => true, 
            // 'show_in_menu' => 'edit.php?post_type=post', // If you want to hook to an existing post type
            'show_in_menu'        => true,
            'query_var'           => true,
            'rewrite'             => array( 'slug' => 'dealer' ),
            'capability_type'     => 'post',
            'map_meta_cap'        => true,
            'has_archive'         => true, 
            'hierarchical'        => false,
            'menu_position'       => null,
            'menu_icon'           => 'dashicons-location',
            'supports'            => array( 'title', 'thumbnail')
          );
  register_post_type( 'dealer', $args ); // Post Type `dealer` reflects to the wp_posts DB Table
}

add_action( 'init', 'dst_custom_post_type');