我正在使用Cherry Framework。我的主题包括自定义帖子类型:投资组合,并且我在此帖子类型下创建了两个类别:读者故事(slug:读者故事)和读者提示(slug:读者提示)。
当我在投资组合下创建帖子并将其分配到其中一个类别(例如:读者故事)时,该帖子的固定链接将如下所示:
mysite.com/portfolios/example_post
但我希望网址为:
mysite.com/portfolios/readers-stories/example_post
我怎样才能做到这一点?
我尝试使用Custom Post Type Permalinks插件。但我没有得到理想的结果。
以下是投资组合帖子类型的register_post_type
功能:
register_post_type( 'portfolio',
array(
'label' => theme_locals("portfolio"),
'singular_label' => theme_locals("portfolio"),
'_builtin' => false,
'public' => true,
'show_ui' => true,
'show_in_nav_menus' => true,
'hierarchical' => true,
'capability_type' => 'page',
'has_archive' => true,
'menu_icon' => get_template_directory_uri() . '/includes/images/icon_portfolio.png',
'rewrite' => array(
'slug' => 'portfolio',
'with_front' => FALSE,
),
'supports' => array(
'title',
'editor',
'thumbnail',
'excerpt',
'custom-fields',
'comments')
)
);
register_taxonomy('portfolio_category', 'portfolio', array('hierarchical' => true, 'label' => theme_locals("categories"), 'singular_name' => theme_locals("category"), "rewrite" => true, "query_var" => true));
register_taxonomy('portfolio_tag', 'portfolio', array('hierarchical' => false, 'label' => theme_locals("tags"), 'singular_name' => theme_locals("tag"), 'rewrite' => true, 'query_var' => true));