2017-04-27 44 views
0

there is no dropdown list coming from custom fields , no thumbnail feature我一直在試圖設計新聞作爲自定義帖子類型,並且我還將必要的代碼添加到了function.php頁面。但自定義字段中仍然沒有下拉列表。這裏是我的代碼函數自定義帖子類型中的自定義字段無法正常工作

[![function news_custom_init() { 
    $args = array(
     'public' => true, 
     'label' => 'News', 
     'has_archive'=>true, 
     'supports' => array('title', 'editor', 'description', 'author', 'thumbnail', 'custom-fields') 
    ); 
    register_post_type('news', $args); 
} 
add_action('init', 'news_custom_init'); 

回答

0

這裏的添加自定義職位類型的一個基本的例子:

add_action('init', 'create_post_type'); 
function create_post_type() { 
    register_post_type('acme_product', 
    array(
     'labels' => array(
     'name' => __('News'), 
     'singular_name' => __('News') 
    ), 
     'public' => true, 
     'has_archive' => true, 
     'supports' => array('title', 'editor', 'description', 'author', 'thumbnail', 'custom-fields') 
    ) 
); 
} 
0
function news_custom_init() { 
$args = array(
     'public' => true, 
     'labels' => array(
       'name' => __('Newss'), 
       'singular_name' => __('News') 
      ), 
     'has_archive'=>true, 
     'publicly_queryable' => true, 
     'show_ui'   => true, 
     'show_in_menu'  => true, 
     'query_var'   => true, 
     'supports' => array('title', 'editor', 'description', 'author', 'thumbnail', 'custom-fields') 
    ); 
    register_post_type('news', $args); 
} 
} 
add_action('init', 'news_custom_init'); 
相關問題