首页 WordPress函数大全 locate_template()

locate_template()

2020-05-02 / 5578阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

locate_template( string|array $template_names, bool $load = false, bool $require_once = true )

检索存在的最高优先级模板文件的名称。

描述

在TEMPLATEPATH和wp-includes / theme-compat之前在STYLESHEETPATH中进行搜索,以便从父主题继承的主题可以重载>

参数

$template_names

(string|array)
(Required)
Template file(s) to search for, in order.

$load

(bool)
(Optional)
If true the template file will be loaded if it is found.

Default value: false

$require_once

(bool)
(Optional)
Whether to require_once or require. Has no effect if $load is false.

Default value: true

返回

(string) The template filename if one is located.

大家谈论
    我的见解