描述:
获取文章页面模板文件single.php
用法:
<?php get_single_template() ?>
参数:
None
源文件:
/**
* Retrieve path of single template in current or parent template.
*
* The template path is filterable via the dynamic {@see '$type_template'} hook,
* e.g. 'single_template'.
*
* @since 1.5.0
*
* @see get_query_template()
*
* @return string Full path to single template file.
*/
function get_single_template() {
$object = get_queried_object();
$templates = array();
if ( ! empty( $object->post_type ) )
$templates[] = "single-{$object->post_type}.php";
$templates[] = "single.php";
return get_query_template( 'single', $templates );
}
写一条评论