現在WordPresを使用してHPを作成しています。
このサイトhttps://www.webcreatorbox.com/tech/custom-post-typeを参考にカスタム投稿ページを作成しているのですが、
上記ページ上にもある add_action('init',XXXX)が反映されません。理由がわかる方はいますか???
コードは以下の通りです。 このコードをfunctions.phpの一番した('?>')の上に追加しております。
PHP
1 2add_action( 'init', 'register_cpt_team' ); 3 4function register_cpt_team() { 5 $labels = array( 6 'name' => __( '隊員', 'team' ), 7 'singular_name' => __( '隊員', 'team' ), 8 'add_new' => __( '新規作成', 'team' ), 9 'add_new_item' => __( '新隊員登録', 'team' ), 10 'edit_item' => __( '隊員情報編集', 'team' ), 11 'new_item' => __( '新隊員', 'team' ), 12 'view_item' => __( '隊員情報を見る', 'team' ), 13 'search_items' => __( '隊員検索', 'team' ), 14 'not_found' => __( '隊員が見つかりません', 'team' ), 15 'not_found_in_trash' => __( 'ゴミ箱に隊員情報がありません', 'team' ), 16 'parent_item_colon' => __( '親:', 'team' ), 17 'menu_name' => __( '隊員', 'team' ), 18 ); 19 20 $args = array( 21 'label' => $labels, 22 'hierarchical' => true, 23 'supports' => array( 'editor', 'excerpt', 'thumbnail', 'custom-fields' ), 24 'public' => false, 25 'show_ui' => false, 26 'show_in_nav_menus' => true, 27 'publicly_queryable' => true, 28 'exclude_from_search' => true, 29 'has_archive' => false, 30 'query_var' => true, 31 'can_export' => true, 32 'rewrite' => true, 33 'capability_type' => 'post' 34 ); 35 36 register_post_type( 'team', $args ); 37} 38
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/03/04 05:49