admin管理员组文章数量:1122832
I've inherited a site from another company recently and found this in their functions.php
file:
function themeLoader()
{
locate_template(include('inc/wp_reset.php'), true, true);
locate_template(include('inc/acf_options.php'), true, true);
locate_template(require('inc/bem_menu.php' ), true, true);
locate_template(require('inc/menus.php' ), true, true);
locate_template(require('inc/custom_wysiwyg_styles.php' ), true, true);
locate_template(require('inc/custom_functions.php' ), true, true);
locate_template(require('inc/resources-post-type.php' ), true, true);
locate_template(require('inc/careers-post-type.php' ), true, true);
}
I've not seen require
used as a function before like this, however after looking it up it seems that it can be used in either way.
However, each require
is wrapped in a locate_template()
call. Would I be right in assuming this locate_template()
call does nothing and silently fails?
If it was the other way round, require(locate_template('...'))
it would make sense to me.
I think the developer got lucky and the folder structure of the theme just happened to match with their referenced paths.
本文标签: phprequire used as a function to load theme dependencies
版权声明:本文标题:php - require used as a function to load theme dependencies? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736299609a1930518.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论