カスタム投稿タイプ追加
カスタム投稿タイプの追加方法は、
functions.php
に以下を追加する。
add_action('init', 'create_post_type');
function create_post_type() {
//カスタム投稿タイプ
register_post_type(
'xxxxx', /* post-type */
array(
'labels' => array(
'name' => __('投稿タイプ名'),
'singular_name' => __('投稿タイプ名')
),
'public' => true,
'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'page-attributes', 'post-formats'),
'menu_position' =>5,
'has_archive' => true
)
);
}
[2015/02/27]