【发布时间】:2018-01-23 11:02:47
【问题描述】:
我目前正在开发自己的旅游网站/博客。我想在这个网站上添加“酒店”和“提示和技巧”。我制作了两种使用默认帖子类别作为分类的自定义帖子类型(如下所示)。我没有费心制作自定义分类法,因为它会使我的工作量增加三倍,因为我只需要复制默认类别中的所有数据。
register_post_type('hotels',
array( 'taxonomies' => array('category'),
'labels' => array(
'name' => __('Hotels'),
'singular_name' => __('Hotel'),
'add_new' => __('Add new hotel'),
'edit_item' => __('Edit hotel'),
'new_item' => __('New hotel'),
'view_item' => __('View hotel'),
'search_items' => __('Search hotels'),
'not_found' => __('No hotels found'),
'not_found_in_trash' => __('No hotels found in trash')
),
'has_archive' => true,
'hierarchical' => true,
'public' => true,
'supports' => array('title', 'editor', 'post-formats')
));
现在,有两件事我似乎无法实现。
- 获取仅显示自定义帖子类型而非我的默认帖子的类别(例如:墨西哥)的链接。 (例如,我想看看墨西哥的酒店)
- 在管理部分(菜单)中获取一个选项,允许我将所述链接添加到菜单中。
任何帮助将不胜感激。
【问题讨论】:
标签: wordpress menu custom-post-type taxonomy custom-taxonomy