常用函数-get_query_template()

0条评论

常用函数-get_query_template()

说明

不用扩展名检索文件路径。

该函数可不检查文件扩展名而快速检索文件路径。若文件存在,函数也可以用locate_template()查看父模板。如果不使用其他get_*_template()函数,允许检索结果出现通用文件所在位置。

该函数可与 include()require() 共同检索路径:

   if ( '' != get_query_template( '404' ) )         
       include( get_query_template( '404' ) );  

以下用法也可以达到同样效果:

  if ( '' != get_404_template() )         
      include( get_404_template() );  

用法

<?php get_query_template( $type ) ?>

参数

$type

(字符串)(必需)没有扩展名的文件名称

默认值:None

返回的值

(字符串)

文件的完全路径

示例

注释

修改记录

自1.5.0版本后

源文件

get_query_template()位于 wp-includes/theme.php中。

相关资源

发表新评论

此内容将保密,不会被其他人看见。
  • 自动将网址与电子邮件地址转变为链接。
  • 允许HTML标签:<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • 自动断行和分段。

更多关於格式化选项的信息

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.