函数原型
get_archive_template(): string
函数描述
Retrieves path of archive template in current or parent template.
是否弃用
未弃用
函数参数
无
函数返回值
string Full path to archive template file.
函数位置
File: wp-includes/template.php.
函数源码
function get_archive_template() {
$post_types = array_filter( (array) get_query_var( 'post_type' ) );
$templates = array();
if ( count( $post_types ) == 1 ) {
$post_type = reset( $post_types );
$templates[] = "archive-{$post_type}.php";
}
$templates[] = 'archive.php';
return get_query_template( 'archive', $templates );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |

