###前提・実現したいこと
複数のカスタム投稿タイプを追加するので、関数で1つにまとめたいです。
###発生している問題・エラーメッセージ
Warning: Missing argument 2 for createPostType(), called in /Users/hoges/Sites/test/wp-includes/class-wp-hook.php on line 298 and defined in /Users/hoges/Sites/test/wp-content/themes/hoges/functions.php on line
###該当のソースコード
PHP
1function createPostType($label, $postType) { 2 register_post_type($postType, 3 [ 4 'label' => $label, 5 'labels' => [ 6 'singular_name' => $label, 7 'add_new_item' => '新規追加', 8 'add_new' => '新規追加', 9 'new_item' => '新規', 10 'view_item' => '表示', 11 'not_found' => '見つかりませんでした', 12 'not_found_in_trash' => 'ゴミ箱にありません。', 13 'search_items' => '検索', 14 ], 15 'menu_icon' => 'dashicons-groups', 16 'public' => true, 17 'hierarchical' => false, 18 'menu_position' => 5, 19 'supports' => ['title','editor','author','thumbnail','excerpt','comments','custom-fields'], 20 ] 21 ); 22} 23add_action('init', 'createPostType'); 24 25createPostType('お客様情報', 'customer');
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/07/18 08:52
2017/07/18 09:59