実装手順
カスタムポストはプラグインで簡単に作成できますが、プラグインで実装すると設定できない項目もあるので、そういう時は自分で追加する必要があります。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | add_action( 'init' , 'custum_post_type' ); function custum_post_type() { //ここからカスタムポストを追加 register_post_type( 'カスタムポスト名(半角英字のみ)' , array ( 'labels' => array ( 'name' => __( '管理画面に表示させたい名前(ここは日本語でも大丈夫です)' ), 'singular_name' => __( '管理画面に表示させたい名前(ここも日本語でも大丈夫です' ) ), //カスタムポストタイプの設定 'public' => true, 'menu_position' => 5, 'hierarchicla' => false, 'has_archive' => true, //投稿編集ページの設定 'supports' => array ( 'title' , 'editor' , 'thumbnail' , //タイトル,編集,アイキャッチ 'custom-fields' , 'excerpt' , 'author' , 'trackbacks' , //カスタムフィールド,抜粋文&作成者,トラックバック 'comments' , 'revisions' , 'page-attributes' ) //コメント,リビジョン,作成者,表示順のボックス ) ); } |