我正试图删除portfolio-view 并按照说明从突出显示的部分中删除其名称。这很有效,但给我留下了\'portfolio\' 现在,即使字段为空。请问这个代码有什么问题或者面包屑需要更改?它现在正在从某处获取“公文包”,我想把它隐藏在url中。
我想得到:http://www.sitename.com/post
而不是http//www.sitename.com/portfolio/post
.
/* Portfolio */
function my_post_type_portfolio() {
register_post_type( \'portfolio\',
array(
\'label\' => __(\'Portfolio\'),
\'singular_label\' => __(\'Porfolio Item\', \'theme\'),
\'_builtin\' => false,
\'public\' => true,
\'show_ui\' => true,
\'show_in_nav_menus\' => true,
\'capability_type\' => \'page\',
\'menu_icon\' => get_template_directory_uri() . \'/includes/images/icon_portfolio.png\',
**\'rewrite\' => array(
\'slug\' => \' \',
\'with_front\' =>false,**
),
\'supports\' => array(
\'title\',
\'editor\',
\'thumbnail\',
\'excerpt\',
\'custom-fields\',
\'comments\')
)
);
register_taxonomy(\'portfoliocat\', \'portfolio\', array(\'hierarchical\' => true, \'label\' => \'Portfolio Categories\', \'singular_name\' => \'Category\', "rewrite" => true, "query_var" => true));
}
add_action(\'init\', \'my_post_type_portfolio\');
面包屑设置为:
<a title="Go to %title%." href="%link%">%htitle%</a>
永久链接:/%postname%/