我遇到了 tgm 的问题,我刚刚从 tgm 网站下载了设置
http://tgmpluginactivation.com/download/
当我按照网站和下载的 zip 文件中描述的步骤进行操作时,但是在按照我激活自定义主题时的步骤进行操作时,它只是激活了它并没有显示任何有关激活所需插件的消息
我的主题function.php文件代码如下
<?php
require_once get_template_directory() . '/includes/class-tgm-plugin-activation.php';
add_action( 'tgmpa_register', 'custom_register_required_plugins' );
function custom_register_required_plugins() {
/*
* Array of plugin arrays. Required keys are name and slug.
* If the source is NOT from the .org repo, then source is also required.
*/
$plugins = array(
// This is an example of how to include a plugin bundled with a theme.
array(
'name' => esc_html__('Visual Composer','custom'),
'slug' => 'js_composer',
'source' => get_template_directory() . '/plugins/js-composer.zip',
'required' => false,
'version' => '5.1.1',
'force_activation' => false,
'force_deactivation' => false,
'external_url' => '',
),
);
$config = array(
'id' => 'custom', // Unique ID for hashing notices for multiple instances of TGMPA.
'default_path' => '', // Default absolute path to bundled plugins.
'menu' => 'tgmpa-install-plugins', // Menu slug.
'has_notices' => true, // Show admin notices or not.
'dismissable' => true, // If false, a user cannot dismiss the nag message.
'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag.
'is_automatic' => false, // Automatically activate plugins after installation or not.
'message' => '', // Message to output right before the plugins table.
);
tgmpa( $plugins, $config );
}
请告诉我这段代码有什么问题,为什么在激活主题后没有显示任何关于激活所需插件的消息