我知道如何创建自定义帖子类型。从 Codex 看来,我应该能够创建一个行为类似于页面的自定义帖子类型,特别是能够使用模板选择器弹出窗口和类别/标签选择器分配模板。
到目前为止,我得到的只是基本编辑器,而且我可以获得一个特色图像选择器。但我正在寻找的基本上是一个我可以将其视为自定义帖子类型的页面。
编辑:我认为这很明显,但我是用functions.php做的:
register_post_type( hh_town,
array(
'labels' => array(
'name' => __( 'Towns' ),
'singular_name' => __( 'Town' ),
'add_new' => _x('Add Town', 'towns'),
'add_new_item' => __('Add Town'),
'edit' => _x('Edit Towns', 'Towns'),
'edit_item' => __('Edit Town'),
'new_item' => __('New Town'),
'view' => _x('View Town', 'towns'),
'view_item' => __('View Town')
),
'public' => true,
'has_archive' => true,
'hierarchical' => true,
'show_ui' => true,
'supports' => array('title','editor','page-attributes','thumbnail', 'custom-fields'),
'capability_type' => 'page',
'taxonomies' => array('post_tag','category')
)
);