admin管理员组文章数量:1328001
I have a child theme folder called themes/child-theme and inside I have a file dashboard_payments.php. Under the child theme folder I'm creating a new folder called gateway and inside there's a config.php.
So, how do I do a require_once inside dashboard_payments.php to call the file gateway/config.php? How would the require_once or include line look like?
I have a child theme folder called themes/child-theme and inside I have a file dashboard_payments.php. Under the child theme folder I'm creating a new folder called gateway and inside there's a config.php.
So, how do I do a require_once inside dashboard_payments.php to call the file gateway/config.php? How would the require_once or include line look like?
Share Improve this question asked Jul 18, 2020 at 22:30 cilapo1541cilapo1541 134 bronze badges 1- Why would you need to do this? – Jeff W Commented Jul 19, 2020 at 4:12
2 Answers
Reset to default 1Since 4.7 get_theme_file_path()
is the right function to use:
require_once get_theme_file_path( 'gateway/config.php' );
You can use either
require_once(get_stylesheet_directory() . '/gateway/config.php');
or (should be faster)
require_once(__DIR__ . '/gateway/config.php');
本文标签: phpHow to specify the path for requireonce in a child theme
版权声明:本文标题:php - How to specify the path for require_once in a child theme? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742249771a2440530.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论