Skip to content

Instantly share code, notes, and snippets.

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 kaoru-fukusato/f3b43480f32a8c12655535cbe8511571 to your computer and use it in GitHub Desktop.
Save kaoru-fukusato/f3b43480f32a8c12655535cbe8511571 to your computer and use it in GitHub Desktop.
functions.phpにカスタム投稿の設定を追加する
function add_custom_post() {
register_post_type(
'infopage',
array(
'label' => 'お知らせ',
'public' => true,
'has_archive' => true,
'menu_position' => 5,
'supports' => array(
'title',
'editor',
'thumbnail',
'revisions',
'excerpt',
'custom-fields',
)
)
);
}
add_action('init', 'add_custom_post');
/////////////////////////
function add_custom_post() {
register_post_type(
'infopage',
array(
'label' => 'お知らせ',
'public' => true,
'has_archive' => true,
'menu_position' => 5,
'supports' => array(
'title',
'editor',
'thumbnail',
'revisions',
'excerpt',
'custom-fields',
)
)
);
register_post_type(
'custom',
array(
'label' => 'カスタム',
'public' => true,
'has_archive' => true,
'menu_position' => 5,
'supports' => array(
'title',
'editor',
'thumbnail',
'revisions',
'excerpt',
'custom-fields',
)
)
);
}
add_action('init', 'add_custom_post');
/////////////////////////
function add_taxonomy() {
//お知らせカテゴリ
register_taxonomy(
'info-cat',
'infopage',
array(
'label' => 'お知らせカテゴリ',
'singular_label' => 'お知らせカテゴリ',
'labels' => array(
'all_items' => 'お知らせカテゴリ一覧',
'add_new_item' => 'お知らせカテゴリを追加'
),
'public' => true,
'show_ui' => true,
'show_in_nav_menus' => true,
'hierarchical' => true
)
);
//お知らせタグ
register_taxonomy(
'info-tag',
'infopage',
array(
'label' => 'お知らせのタグ',
'singular_label' => 'お知らせのタグ',
'labels' => array(
'add_new_item' => 'お知らせのタグを追加'
),
'public' => true,
'show_ui' => true,
'show_in_nav_menus' => true,
'hierarchical' => false
)
);
}
add_action( 'init', 'add_taxonomy' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment