Tomjesch
4/26/2016 - 9:59 AM

Custom post type

Custom post type

<?php
  
add_action( 'init', 'create_stock_post_type' );
function create_stock_post_type() {
  register_post_type( 'stock',
  array(
    'labels' => array(
      'name' => __( 'Tito\'s Stock' ),
      'add_new' => __( 'New stock item' ),
      'add_new_item' => __( 'Add new stock item' ),
      'edit_item' => __( 'Edit stock item' ),
      'new_item' => __( 'New stock item' ),
      'view_item' => __( 'View stock item' ),
      'search_items' => __( 'Search stock item' ),
      'not_found_in_trash' => __( 'No stock items found' ),
      'all_items' => __( 'All stock items' ),
      'featured_image' => __( 'Featured image' ),
      'set_featured_image' => __( 'Set featured image' ),
      'remove_featured_image' => __( 'Remove featured image' ),
      'use_featured_image' => __( 'Use as featured image' ),
      'singular_name' => __( 'Stock item' ),
    ),
    'public'      => true,
    'exclude_from_search' => false,
    'has_archive'   => true,
    // 'rewrite'       => array( 'slug' => 'truck' ),
    'supports' => array(
              'title',
              'editor',
              'thumbnail',
              'excerpt',
              'revisions'

          ),
    'capability_type'    => 'post',
    'menu_icon'     => 'dashicons-marker',
    'menu_position' => 7
  )
  );
}

add_action( 'init', 'create_stock_taxonomy', 0 );
?>