您可以使用WordPress Template Hierarchy.
复制您的类别。php文件并重命名。
category-{slug}.php – If the category’s slug is news, WordPress will look for category-news.php.
category-{id}.php – If the category’s ID is 6, WordPress will look for category-6.php.
category.php
您还可以使用template\\u include来
conditionally 显示模板
add_filter( \'template_include\', \'category_page_template\', 99 );
function category_page_template( $template ) {
if ( is_category() ) {
$new_template = locate_template( array( \'your-template.php\' ) );
if ( \'\' != $new_template ) {
return $new_template;
}
}
return $template;
}