Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

クラス一覧

テンプレにも使えるかも

// Register Custom Post Type
function custom_post_type_classes() {

	$labels = array(
		'name'                  => _x( 'classes', 'Post Type General Name', 'text_domain' ),
		'singular_name'         => _x( 'class', 'Post Type Singular Name', 'text_domain' ),
		'menu_name'             => __( 'クラス一覧', 'text_domain' ),
		'name_admin_bar'        => __( 'クラス一覧', 'text_domain' ),
		'archives'              => __( 'クラス一覧', 'text_domain' ),
		'parent_item_colon'     => __( '親ページ:', 'text_domain' ),
		'all_items'             => __( '全てのページを見る', 'text_domain' ),
		'add_new_item'          => __( '新たにページを追加する', 'text_domain' ),
		'add_new'               => __( '新たにページを追加する', 'text_domain' ),
		'new_item'              => __( '新たにページを追加する', 'text_domain' ),
		'edit_item'             => __( 'ページを編集する', 'text_domain' ),
		'update_item'           => __( 'ページをアップデート', 'text_domain' ),
		'view_item'             => __( 'ページを確認する', 'text_domain' ),
		'search_items'          => __( '検索する', 'text_domain' ),
		'not_found'             => __( '見つかりませんでした', 'text_domain' ),
		'not_found_in_trash'    => __( 'ゴミ箱の中に見つかりませんでした', 'text_domain' ),
		'featured_image'        => __( 'サムネイル画像', 'text_domain' ),
		'set_featured_image'    => __( 'サムネイル画像を設定する', 'text_domain' ),
		'remove_featured_image' => __( 'サムネイル画像の設定を解除する', 'text_domain' ),
		'use_featured_image'    => __( 'サムネイル画像として使用する', 'text_domain' ),
		'insert_into_item'      => __( 'ファイルをページに追加する', 'text_domain' ),
		'uploaded_to_this_item' => __( 'このページにアップロードされたファイル', 'text_domain' ),
		'items_list'            => __( 'ページ一覧', 'text_domain' ),
		'items_list_navigation' => __( 'ページ一覧のナビゲーション', 'text_domain' ),
		'filter_items_list'     => __( 'ページ一覧をフィルタリングする', 'text_domain' ),
	);
	$rewrite = array(
		'slug'                  => 'class',
		'with_front'            => true,
		'pages'                 => false,
		'feeds'                 => false,
	);
	$args = array(
		'label'                 => __( 'class', 'text_domain' ),
		'description'           => __( 'クラス情報を管理するための投稿タイプ', 'text_domain' ),
		'labels'                => $labels,
		'supports'              => array( 'title', 'excerpt', 'revisions', 'custom-fields', 'post-formats', ),
		'hierarchical'          => true,
		'public'                => true,
		'show_ui'               => true,
		'show_in_menu'          => true,
		'menu_position'         => 5,
		'menu_icon'             => 'dashicons-editor-ol',
		'show_in_admin_bar'     => true,
		'show_in_nav_menus'     => true,
		'can_export'            => true,
		'has_archive'           => 'class',
		'exclude_from_search'   => false,
		'publicly_queryable'    => true,
		'rewrite'               => $rewrite,
		'capability_type'       => 'page',
	);
	register_post_type( 'class', $args );

}
add_action( 'init', 'custom_post_type_classes', 0 );