get_post_type_archive_template()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
get_post_type_archive_template(): string
Описание
Иерархия шаблонов и путь к шаблону могут быть отфильтрованы через динамические хуки '$type_template_hierarchy' и '$type_template', где $type равно 'archive'.
См. alsoget_archive_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:176
function get_post_type_archive_template() {
$post_type = get_query_var( 'post_type' );
if ( is_array( $post_type ) ) {
$post_type = reset( $post_type );
}
$obj = get_post_type_object( $post_type );
if ( ! ( $obj instanceof WP_Post_Type ) || ! $obj->has_archive ) {
return '';
}
return get_archive_template();
}
История изменений
| Версия | Описание |
|---|---|
| 3.7.0 | Introduced. |

