0
私は自分のプロジェクトのカスタム投稿タイプを作成しました。私はカスタム属性を持つカスタム投稿タイプを追加します。管理者側ではなく、「テンプレート」フィールドオプションなしで二つのフィールド(「親」と「注文」)が付属して、このコード・ページ属性オプションを使用ワードプレスでカスタム投稿タイプへのページ属性の追加
function register_pt_boutique()
{
register_post_type('boutique', array(
'label' => 'Boutiques',
'description' => 'This post type represents the featured items on the homepage.',
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'capability_type' => 'post',
'map_meta_cap' => true,
'hierarchical' => true,
// 'rewrite' => array('slug' => 'featured', 'hierarchical' => true, 'with_front' => false),
'query_var' => true,
'has_archive' => true,
'menu_position' => '7',
'supports' => array('title', 'page-attributes','thumbnail'),
// 'taxonomies' => array('page-attributes'),
'labels' => array(
'name' => 'Boutiques',
'singular_name' => 'Boutique',
'menu_name' => 'Boutiques',
'add_new' => 'Add Boutique',
'add_new_item' => 'Add New Boutique',
'edit' => 'Edit',
'edit_item' => 'Edit Boutique',
'new_item' => 'New Boutique',
'view' => 'View Boutique',
'view_item' => 'View Boutique',
'search_items' => 'Search Boutique',
'not_found' => 'No Boutique',
'not_found_in_trash' => 'No Boutique Found in Trash',
'parent' => 'Parent Boutique',
)
));
}
:私は、次のコードでこれを行っています。私は、 "テンプレート"フィールドを持つページ属性が必要です。ワードプレス4.7
ソリューションへのリンクは歓迎ですが、確認してくださいあなたの答えはそれなしに有用である:([リンクの周りにコンテキストを追加]//meta.stackexchange.com/a/8259)あなたの仲間のユーザーは、それが何であるか、なぜそれがあるのかをいくつか考えて、目標ページが利用できない場合にリンクしているページの最も関連性の高い部分を引用します。 [リンクよりほんの少しの回答は削除されるかもしれません](// stackoverflow.com/help/deleted-answers) – Frits
このリンクは質問に答えるかもしれませんが、ここでは答えの重要な部分を含めることをお勧めします。参照のためのリンク。リンクされたページが変更された場合、リンクのみの回答は無効になります。 - [レビューから](/レビュー/低品質の投稿/ 16889661) – Manoj