get_archive_template()
get_archive_template()
检索当前模板或父模板中存档模板的路径。
Retrieve path of archive template in current or parent template.
说明(Description)
另见函数 get_query_template()
返回(Return)
(string)存档模板文件的完整路径。
源码(Source)
/** * Retrieve path of archive template in current or parent template. * * The template path is filterable via the dynamic {@see '$type_template'} hook, * e.g. 'archive_template'. * * @since 1.5.0 * * @see get_query_template() * * @return string Full path to archive template file. */ 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 ); }
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
1.5.0 | wp-includes/template.php:110 | 1 function | 2 |
get_archive_template() 为WP2原创文章,链接:https://www.wp2.cn/functions/get_archive_template/