如何创建%post\\u type%/%postname%/永久链接结构?
This is what is not working:
例如(domain.com/blog/)->“点击帖子”(domain.com/post-name)
How do I make "blog post" permalinks work like this...
例如(domain.com/blog/)->“点击帖子”(domain.com/
blog/职位名称)
<小时>
Although other custom post types work?...
例如(domain.com/portfolio/)->“点击公文包条目”(domain.com/portfolio/project)
还有,我应该重新冲洗Permalinks吗?
这是自定义帖子类型代码(&A);我的函数中的分类法代码。php文件:
// Add Custom Post Type "Portfolio"
register_post_type(\'portfolio\', array( \'label\' => \'Portfolio\',
\'description\' => \'\',
\'public\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'capability_type\' => \'post\',
\'hierarchical\' => false,
\'rewrite\' => array(\'slug\' => \'portfolio\'),
\'query_var\' => true,
\'supports\' => array(\'title\',
\'revisions\',),
\'taxonomies\' => array(\'Portfolio Category\',),
\'labels\' => array (
\'name\' => \'Portfolio\',
\'singular_name\' => \'Project\',
\'menu_name\' => \'Portfolio\',
\'add_new\' => \'Add Project\',
\'add_new_item\' => \'Add New Project\',
\'edit\' => \'Edit\',
\'edit_item\' => \'Edit Project\',
\'new_item\' => \'New Project\',
\'view\' => \'View\',
\'view_item\' => \'View Portfolio Piece\',
\'search_items\' => \'Search Portfolio\',
\'not_found\' => \'No Portfolio Pieces Found\',
\'not_found_in_trash\' => \'No Portfolio Pieces found in Trash\',
\'parent\' => \'Parent Project\',
),) );
// Add Custom Post Type "Testimonials"
register_post_type(\'testimonials\', array(
\'label\' => \'Testimonials\',
\'description\' => \'\',
\'public\' => true,\'show_ui\' => true,
\'show_in_menu\' => true,
\'capability_type\' => \'post\',
\'hierarchical\' => false,
\'rewrite\' => array(\'slug\' => \'\'),
\'query_var\' => true,
\'supports\' => array(\'title\',
\'revisions\',),
\'labels\' => array (
\'name\' => \'Testimonials\',
\'singular_name\' => \'Testimonial\',
\'menu_name\' => \'Testimonials\',
\'add_new\' => \'Add New\',
\'add_new_item\' => \'Add New Testimonial\',
\'edit\' => \'Edit\',
\'edit_item\' => \'Edit Testimonial\',
\'new_item\' => \'New Testimonial\',
\'view\' => \'View\',
\'view_item\' => \'View Testimonial\',
\'search_items\' => \'Search Testimonials\',
\'not_found\' => \'No Testimonials Found\',
\'not_found_in_trash\' => \'No Testimonials Found in Trash\',
\'parent\' => \'Parent Testimonial\',
),) );
//Add Taxonomy for Portfolio Category
add_action( \'init\', \'portfolio_create_taxonomies\', 0 );
function portfolio_create_taxonomies()
{
//Porfolio Category
$portfolio_labels = array(
\'name\' => _x( \'Portfolio Category\', \'taxonomy general name\' ),
\'singular_name\' => _x( \'Portfolio Category\', \'taxonomy singular name\' ),
\'search_items\' => __( \'Search in portfolio category\' ),
\'all_items\' => __( \'All portfolio categories\' ),
\'most_used_items\' => null,
\'parent_item\' => null,
\'parent_item_colon\' => null,
\'edit_item\' => __( \'Edit portfolio category\' ),
\'update_item\' => __( \'Update portfolio category\' ),
\'add_new_item\' => __( \'Add new portfolio category\' ),
\'new_item_name\' => __( \'New portfolio category\' ),
\'menu_name\' => __( \'Portfolio Categories\' ),
);
register_taxonomy(\'portfolio-category\',array(\'portfolio\'),array(
\'hierarchical\' => true,
\'labels\' => $portfolio_labels,
\'show_ui\' => true,
\'query_var\' => true,
\'rewrite\' => array(\'slug\' => \'portfolio-category\')
));
}
编辑:我认为这个问题的出现是因为一个模板继承人的问题,博客页面正在使用“index.php”,而它应该使用“template blog.php”文件。