gpt4 book ai didi

php - 在 functions.php WordPress 中包含外部文件

转载 作者:可可西里 更新时间:2023-11-01 13:36:12 25 4
gpt4 key购买 nike

在我的 WordPress 中,我有一个包含 1500 行代码的 functions.php 文件。

大部分代码来 self 编写的连接到 API 并将数据从 WordPress 发送到它的程序。我不是 WordPress 开发人员,所以我不知道这是否可行。你能制作一个不同的文件来保持 functions.php 干净,然后将外部文件包含在 functions.php 中吗?

最佳答案

如果您正在使用子主题但找不到包含路由的路径:

尝试以下操作:

include_once(get_stylesheet_directory() .'/xxxx/anyfilename.php');

检查 get_stylesheet_directory() 以查看您的子主题路径。

关于php - 在 functions.php WordPress 中包含外部文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43543961/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com