カスタム投稿タイプの定義(前回紹介したもの同じ)プラグイン(phpファイル)に書き込みます
<?php
/*
Plugin Name: Product Post Type
Plugin URI: http://old-pine.net
Description: Product of the custom post type which created with a new custom plugin
Version: 1.0
Author: Old-pine
Author URI: http://old-pine.net/
License: GPLv2
*/
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
load_plugin_textdomain("product",false , 'product-post-type/languages');
add_action( 'init', 'my_custom_post_product' );
function my_custom_post_product() {
$labels = array(
'name' => _x( 'Products', 'post type general name', 'product' ),
'singular_name' => _x( 'Product', 'post type singular name', 'product' ),
'add_new' => _x( 'Add New', 'post type singular name', 'product' ),
'add_new_item' => __( 'Add New Product', 'product' ),
'edit_item' => __( 'Edit Product', 'product' ),
'new_item' => __( 'New Product', 'product' ),
'all_items' => __( 'All Products', 'product' ),
'view_item' => __( 'View Product', 'product' ),
'search_items' => __( 'Search Products', 'product' ),
'not_found' => __( 'No products found', 'product' ),
'not_found_in_trash' => __( 'No products found in the Trash', 'product' ),
'parent_item_colon' => '',
'menu_name' => __('Products', 'product'),
);
$args = array(
'labels' => $labels,
'description' => 'Holds our products and product specific data',
'public' => true,
'menu_position' => 5,
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),
'has_archive' => true,
'hierarchical' => false,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'product', $args );
}