2016-09-02 44 views
0

我已經爲我的項目創建了自定義文章類型,我想添加頁面屬性的自定義文章類型。在wordpress中添加頁面屬性到自定義文章類型

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', 
 
     ) 
 
    )); 
 
}

使用此代碼頁屬性選項都與管理方面,但沒有「模板」字段中選擇兩個字段(「父」和「秩序」):我有下面的代碼這樣做。我想要「模板」字段的頁面屬性。

回答

-1

從WordPress的4.7,你可以包括現場的「模板」直接從德文件https://make.wordpress.org/core/2016/11/03/post-type-templates-in-4-7/

+0

一個解決方案的鏈接是值得歡迎的,但請確保你的答案沒有它是有用的:[添加背景周圍的鏈接](/ /meta.stackexchange.com/a/8259),這樣你的同行用戶就會知道它是什麼以及它爲什麼存在,然後引用鏈接的頁面中最相關的部分,以防目標頁面不可用。 [只有鏈接的答案可能會被刪除。](// stackoverflow.com/help/deleted-answers) – Frits

+0

雖然這個鏈接可能回答這個問題,但最好在這裏包含答案的基本部分,並提供該鏈接供參考。如果鏈接頁面更改,則僅鏈接答案可能會失效。 - [來自評論](/ review/low-quality-posts/16889661) – Manoj

相關問題