2017-09-23 35 views
1

我想要將圖像添加到我的自定義分類演員,但是當我查看編輯actor選項時,它只顯示選項名稱,slug &說明。 我需要在functions.php中爲上述問題添加一個選項。wordpress將圖像添加到分類演員

//////////////////////////////////// 
//   TAXONOMY ACTORS  // 
//////////////////////////////////// 

register_taxonomy(
    'actor', 
    array('movies'), 
    array(
     'labels'   => array(
     'name'    => __('Actors'), 
     'singular_name'  => __('Actor'), 
     'search_items'  => __('Search Actors'), 
     'all_items'   => __('All Actors'), 
     'parent_item'  => __('Parent Actor'), 
     'parent_item_colon' => __('Parent Actor:'), 
     'view_item'   => __('View Actor'), 
     'edit_item'   => __('Edit Actor'), 
     'update_item'  => __('Update Actor'), 
     'add_new_item'  => __('Add New Actor'), 
     'new_item_name'  => __('New Actor Name'), 
     'menu_name'   => __('Actor'), 
     ), 
     'hierarchical'  => false, 
     'show_ui'   => true, 
     'show_admin_column' => true, 
     'query_var'   => true, 
     'rewrite'   => array('slug' => 'actor'), 
    ) 
); 

我試圖找出如何在不詢問這裏的情況下實現這一點,所以任何幫助表示讚賞。

回答

0

嘗試添加supports參數:

'supports' => array('thumbnail'), 

例如:

... 
     'hierarchical'  => false, 
     'show_ui'   => true, 
     'show_admin_column' => true, 
     'query_var'   => true, 
     'rewrite'   => array('slug' => 'actor'), 
     'supports'   => array('thumbnail'), 
    ) 
); 

有關詳細信息,請參閱:在this guide步驟5功能實現」:

'supports' => array('title', 'editor', 'comments', 'thumbnail', 'custom-fields')決定了th的功能e要顯示的自定義帖子類型。

+0

我已經將上述代碼添加到我的functions.php中,現在我需要的是將圖像文件添加到編輯actor頁面的選項。 – scottiescotsman

+0

我已成功將該支持添加到我的functions.php中。但是,如何在我的網站上查看圖像,因爲它已將它保存到某個分類演員中。 tvm – scottiescotsman

+0

您可以提出有關下一階段任務的新問題。你越詳細描述你已經完成的工作和遇到的困難,越早來自社區的人會爲你提供合適的解決方案。 –