Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WordPress > snippets > custom post type
/**
* カスタム投稿タイプ example
*/
add_action('init', 'create_example');
function create_example(){
$labels = array(
'name' => 'サンプル',
'singular_name' => 'サンプル',
'add_new' => 'サンプルを追加',
'add_new_item' => '新しいサンプルを追加',
'edit_item' => 'サンプルを編集',
'new_item' => '新しいサンプル',
'view_item' => 'サンプルを編集',
'search_items' => 'サンプルを探す',
'not_found' => 'サンプルはありません',
'not_found_in_trash' => 'ゴミ箱にサンプルはありません',
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'capability_type' => 'post',
'hierarchical' => false,
'has_archive' => true,
'supports' => array(
'title',
'editor'
)
);
register_post_type('example', $args);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment