Created
March 15, 2020 06:13
-
-
Save kaoru-fukusato/f3b43480f32a8c12655535cbe8511571 to your computer and use it in GitHub Desktop.
functions.phpにカスタム投稿の設定を追加する
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
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