编辑的答案:
TMG是WordPress非常流行的自动插件安装程序,许多高级主题作者都使用它。您可以在这里获得php类https://github.com/thomasgriffin/TGM-Plugin-Activation. 此外,当您下载它时,您将得到一个名为example的php文件。php。你只需要包括这个例子。函数中的php文件。php文件,您只需编辑该文件即可自动安装主题所需的插件。
您必须在示例中执行类似的操作。php文件
// This is an example of how to include a plugin pre-packaged with a theme.
array(
\'name\' => \'WpMania Slider\', // The plugin name.
\'slug\' => \'WpmSlider\', // The plugin slug (typically the folder name).
\'source\' => get_template_directory_uri() . \'/assets/plugins/plugins/WpmSlider.zip\', // The plugin source.
\'required\' => true, // If false, the plugin is only \'recommended\' instead of required.
\'version\' => \'\', // E.g. 1.0.0. If set, the active plugin must be this version or higher.
\'force_activation\' => true, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
\'force_deactivation\' => true, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
\'external_url\' => \'\', // If set, overrides default API URL and points to an external URL.
),
ThanksSabbir公司