0

到处都是,我的意思是每个教程中的每个人都提到了,你必须像这样安装插件

1) 访问 WordPress 管理屏幕并导航到插件 > 添加新的。

2) 搜索 bbPress

3)找到bbPress插件并点击安装

4) 激活插件

但我不希望人们必须安装它,我希望插件已经集成到我正在构建的自定义主题中。但是当我将它复制到我的插件文件夹时(在我的自定义主题文件夹中,而不是“wp-conetnt/plugins”!!),我在我的functions.php 中需要它。在此之后,网络堆积起来,它杀死了我的浏览器,因为有数百条错误消息:

警告:ksort() 期望参数 1 是数组,在第 316 行的 /www/doc/domain/www/wp-content/themes/theme/plugins/bbpress/includes/core/template-functions.php 中给出了 null

警告:reset() 期望参数 1 为数组,在第 321 行的 /www/doc/domain/www/wp-content/themes/theme/plugins/bbpress/includes/core/template-functions.php 中给出 null

......

有人知道如何整合它吗?如果有教程就好了。我到处都可以找到如何使用它,或者通过 zip 上传安装它的 4 个步骤。

感谢帮助

4

2 回答 2

1

There are reasons that plugins are kept separate from themes and located in a different directory and there is a fair amount of debate as to what belongs in a plugin and what belongs in a theme.

The problem is that bb-press was written as a plugin and the paths expect it to be in the plugin directory. In order to include it directly into the theme you would have to rewrite all paths in the plugin. I don't think this is an advisable course of action but if you really want to do this you could a find and replace to change all the paths put given the complexity of bbPress you are likely to encounter problems nontheless.

Or you could have it automatically install with the theme like As described in this article

Another problem with including a plugin is that your wouldn't benefit from security updates and with something like bbPress where there is content written into your db by the general public, the risk would be very high.

于 2014-02-24T17:14:13.610 回答
0

感谢帮助。我已经尝试过这个 TGM 类来包含 WPBakery Visual Composer,但是不可能简单地将它添加到我的主题中,让用户不必安装它。关键是我的主题中有大约 10 个插件,当用户安装我的主题时,他会有 10 个通知,他必须安装一些插件。用户必须安装一些东西,这很烦人。我认为如果他购买主题,安装它,激活它并开始使用它,而不必浪费时间安装一些额外的插件,逻辑会更好,你看我。

于 2014-02-25T09:04:54.130 回答