2012-03-20 87 views
0

我已经创建了如下的自定义文章。它在我的后台管理面板中显示得很好,但是当我去查看帖子时,它是空的。请参阅here获取我的其中一个自定义帖子。我错过了什么,告诉wordpresshwo显示字段?为什么我的自定义帖子字段没有显示在视图中?

add_action('init', 'give_gnt_register'); 

function give_gnt_register() { 

$labels = array(
    'name' => _x('Offered items'), 
    'singular_name' => _x('Item'), 
    'add_new' => _x('Give an item away'), 
    'add_new_item' => __('Give a new item away'), 
    'edit_item' => __('Edit item'), 
    'new_item' => __('Give Item Away'), 
    'view_item' => __('View Item'), 
    'search_items' => __('Search Offered Items'), 
    'not_found' => __('Nothing found'), 
    'not_found_in_trash' => __('Nothing found in Trash'), 
    'parent_item_colon' => '' 
); 

$args = array(
    'labels' => $labels, 
    'public' => true, 
    'publicly_queryable' => true, 
    'show_ui' => true, 
    'query_var' => true, 
    'menu_icon' => get_stylesheet_directory_uri() . '/article16.png', 
    'rewrite' => true, 
    'capability_type' => 'post', 
    'hierarchical' => false, 
    'menu_position' => null, 
    'taxonomies' => array('category'), 
    'supports' => array('title','thumbnail', 'custom-fields','comments') 
); 

register_post_type('give' , $args); 

}

+0

我不知道是否因为我的自定义帖子类型使用插件的高级自定义字段来显示我想要的字段 – Nicola 2012-03-20 16:08:44

回答

0
add_action('init', 'give_gnt_register'); 
function give_gnt_register() { 
wp_create_category('Give'); 
$labels = array(
    'name' => _x('Offered items'), 
    'singular_name' => _x('Item'), 
    'add_new' => _x('Give an item away'), 
    'add_new_item' => __('Give a new item away'), 
    'edit_item' => __('Edit item'), 
    'new_item' => __('Give Item Away'), 
    'view_item' => __('View Item'), 
    'search_items' => __('Search Offered Items'), 
    'not_found' => __('Nothing found'), 
    'not_found_in_trash' => __('Nothing found in Trash'), 
    'parent_item_colon' => '' 
); 

$args = array(
    'labels' => $labels, 
    'public' => true, 
    'publicly_queryable' => true, 
    'show_ui' => true, 
    'query_var' => true, 
    'menu_icon' => get_stylesheet_directory_uri() . '/article16.png', 
    'rewrite' => true, 
    'capability_type' => 'post', 
    'hierarchical' => false, 
    'menu_position' => null, 
    'taxonomies' => array('category'), 
    'supports' => array('title','thumbnail', 'custom-fields','comments') 
); 

    // create "give" post type 
    register_post_type('give', $args); 
} 

我只是添加wp_create_category

祝你好运。

相关问题