检索当前或父模板中的嵌入模板路径。
原型
get_embed_template()
描述
此模板的层次结构如下所示:
参考:
- get_query_template()
返回值
(string)
嵌入模板文件的完整路径。
源文件
路径:wp-includes/template.php
<?php
...
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 );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/get_embed_template/