我有一个自定义帖子类型,使用以下自定义类别:
add_action( \'init\', \'create_post_type\' );
function create_post_type() {
register_post_type( \'products\',
array(
\'labels\' => array(
\'name\' => __( \'Products\' ),
\'singular_name\' => __( \'Product\' )
),
\'capability_type\' => \'post\',
\'supports\' => array(\'title\',\'editor\',\'comments\'),
\'public\' => true,
\'has_archive\' => true,
\'rewrite\' => array( \'slug\' => \'products\' ),
)
);
}
function news_init() {
// create a new taxonomy
register_taxonomy(
\'products\',
\'products\',
array(
\'label\' => __( \'Product Categories\' ),
\'sort\' => true,
\'hierarchical\' => true,
\'args\' => array( \'orderby\' => \'term_order\' ),
\'rewrite\' => array( \'slug\' => \'products\' )
)
);
}
add_action( \'init\', \'news_init\' );
由于某些原因,我无法显示特定类别的帖子。有人能给我指出正确的方向吗?
例如,我试图转到url/产品/类别/监视器,但它显示了一个未找到的页面。我复制了档案。php模板,并将其重命名为类别监视器。php。