get_embed_template()
Retrieves an embed template path in the current or parent template.
The hierarchy for this template looks like:
- embed-{post_type}-{post_format}.php
- embed-{post_type}.php
- embed.php
An example of this is:
- embed-post-audio.php
- embed-post.php
- embed.php
The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} and {@see '$type_template'} dynamic hooks, where $type is 'embed'.
Хуков нет.
Возвращает
Строку
. Full path to embed template file.
Использование
get_embed_template();
Заметки
- Смотрите: get_query_template()
Список изменений
С версии 4.5.0 | Введена. |
Код get_embed_template() get embed template WP 6.2
function get_embed_template() { $object = get_queried_object(); $templates = array(); if ( ! empty( $object->post_type ) ) { $post_format = get_post_format( $object ); if ( $post_format ) { $templates[] = "embed-{$object->post_type}-{$post_format}.php"; } $templates[] = "embed-{$object->post_type}.php"; } $templates[] = 'embed.php'; return get_query_template( 'embed', $templates ); }