Skip to content

Instantly share code, notes, and snippets.

@s-hiroshi
Created August 24, 2012 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s-hiroshi/3447252 to your computer and use it in GitHub Desktop.
Save s-hiroshi/3447252 to your computer and use it in GitHub Desktop.
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