WordPress カスタム投稿タイプの追加の仕方

wordpress
以下のように書いてカスタム投稿タイプを追加しました。
「wordpress register_post_type カスタム投稿」
「wordpress register_taxonomy カスタム投稿」
等とググると関連記事がたくさんヒットするでしょう。
functions.php
/* カスタム投稿タイプの追加2 */
    register_post_type( ‘information’, /* post-type */
    array(
      ‘labels’ => array(
        ‘name’ => ‘インフォメーション’,
        ‘singular_name’ => ‘インフォメーション’,
    ‘add_new_item’ => ‘インフォメーションの新規追加’,
        ‘edit_item’ => ‘インフォメーションの編集’
      ),
      ‘public’ => true,
      ‘menu_position’ =>7,
      ‘has_archive’ => true,
      ‘rewrite’ => array(‘with_front’ => false),
      ‘supports’ => array(‘title’,’editor’,’thumbnail’)
    )
  );
  register_taxonomy(
    ‘information-cat’,
    ‘information’,
    array(
      ‘hierarchical’ => true,
      ‘update_count_callback’ => ‘_update_post_term_count’,
      ‘label’ => ‘インフォメーションのカテゴリー’,
      ‘singular_label’ => ‘インフォメーションのカテゴリー’,
      ‘public’ => true,
      ‘show_ui’ => true
    )
  );

コメント

タイトルとURLをコピーしました