Created
August 24, 2012 07:49
WordPress > snippets > custom post type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* カスタム投稿タイプ 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