WordPress函数文档get_author_template()
获取作者栏目页面模版文件author.php 描述 译文 检索当前模板或父模板的作者模板路径。 原文 Retr…
获取作者栏目页面模版文件author.php
描述
译文
检索当前模板或父模板的作者模板路径。
原文
Retrieve path of author template in current or parent template.
用法
<?php get_author_template() ?>
参数
None.
返回值
(string)
Returns result from get_query_template(‘author’)
注意
- 使用到: get_query_template();
 
历史
添加于 版本: 1.5.0
源文件
get_author_template() 函数的代码位于 wp-includes/template.php.
| 
 1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
 | 
 /* ———————————- 
 * wordpress函数 kim收集 
 * ———————————- */ 
/** 
 * Retrieve path of author template in current or parent template. 
 * 
 * The template path is filterable via the dynamic {@see ‘$type_template’} hook, 
 * e.g. ‘author_template’. 
 * 
 * @since 1.5.0 
 * 
 * @see get_query_template() 
 * 
 * @return string Full path to author template file. 
 */ 
function get_author_template() {
 
	$author = get_queried_object();
 
	$templates = array();
 
	if ( $author instanceof WP_User ) {
 
		$templates[] = “author-{$author->user_nicename}.php”;
 
		$templates[] = “author-{$author->ID}.php”;
 
	}
 
	$templates[] = ‘author.php’;
 
	return get_query_template( ‘author’, $templates );
 
} 
 | 
相关
- 原文:http://codex.wordpress.org/Function_Reference/get_author_template
 
类别:WordPress函数文档、 
		本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

评论功能已经关闭!