get_archive_template()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
get_archive_template(): string
Описание
Иерархия шаблонов и путь к шаблону могут быть отфильтрованы через динамические хуки '$type_template_hierarchy' и '$type_template', где $type равно 'archive'.
См. alsoget_query_template()
Оригинал (английский)
The template hierarchy and template path are filterable via the ‘$type_template_hierarchy’ and ‘$type_template’ dynamic hooks, where $type is ‘archive’.
Возвращаемое значение
string
Исходный код
wp-includes/template.php:150
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 | Introduced. |

