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