我正在使用WordPress主题,这个主题有电子邮件订阅小部件。所以我想在主题中包含MailChimp插件。怎么做?
答案 0 :(得分:0)
很抱歉,您不能在主题中使用mailchimp插件作为嵌入式插件。但是您可以使用TGM插件激活文件将插件包含在您的主题中。从此处TGM plugin activation class下载TGM类文件的副本,然后将class-tgm-plugin-activation.php
文件复制到您的主题目录,并将以下代码添加到主题的functions.php
文件中。
<?php
require get_template_directory() . '/class-tgm-plugin-activation.php'; //add your file path where you put the file
add_action( 'tgmpa_register', 'something_register_required_plugins' );
function something_register_required_plugins() {
$plugins = array(
array(
'name' => 'Mailchimp',
'slug' => 'mailchimp',
'required' => true,
),
);
$config = array(
'id' => 'something', // Unique ID for hashing notices for multiple instances of TGMPA.
'default_path' => '', // Default absolute path to bundled plugins.
'menu' => 'tgmpa-install-plugins', // Menu slug.
'parent_slug' => 'themes.php', // Parent menu slug.
'capability' => 'edit_theme_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used.
'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 );
}
?>
这将为您的用户创建一个建议,以便从wordpress.org存储库
安装mailchimp插件