get_category_template()
最后更新于:2021-11-26 07:25:20
get_category_template()Retrieve path of category template in current or parent template.
响应
(string) Full path to category template file.
源文件
文件: gc-includes/template.php
function get_category_template() {
$category = get_queried_object();
$templates = array();
if ( ! empty( $category->slug ) ) {
$slug_decoded = urldecode( $category->slug );
if ( $slug_decoded !== $category->slug ) {
$templates[] = "category-{$slug_decoded}.php";
}
$templates[] = "category-{$category->slug}.php";
$templates[] = "category-{$category->term_id}.php";
}
$templates[] = 'category.php';
return get_query_template( 'category', $templates );
}