示例代码如下:
//MailPoet
if (class_exists('WYSIJA')) {
// Create a new newsletter
$newsletter_id = WYSIJA::createNewsletter($name, $sender_name, $sender_email, WYSIJA::getUserId());
// Create a new list
$list_id = WYSIJA::createList($name, $description, WYSIJA::getUserId());
// Subscribe a user to a list
WYSIJA::subscribe('name@example.com', $list_id, array('firstname' => 'John', 'lastname' => 'Doe'));
}
//Newsletter
if (class_exists('newsletter')) {
// Create a new newsletter
$newsletter_id = newsletter_create_new_newsletter($name, $subject, $preheader, $from_name, $from_email);
// Create a new list
$list_id = newsletter_create_new_list($name, $description);
// Subscribe a user to a list
newsletter_subscribe($list_id, array('email' => 'name@example.com', 'firstname' => 'John', 'lastname' => 'Doe'));
}
//OptinMonster
if (class_exists('OptinMonster')) {
// Create a new campaign
$campaign_id = OptinMonster_CreateCampaign($name);
// Create a new opt-in form
$form_id = OptinMonster_CreateOptinForm($name, $campaign_id, $template_id, $headline, $subheadline);
// Display the opt-in form
echo OptinMonster_DisplayOptinForm($form_id);
}
//Bloom
if (class_exists('Bloom')) {
// Create a new email opt-in form
$form_id = Bloom_CreateOptinForm($name, $template_id, $list_id, $activate_pop_up);
// Display the email opt-in form
echo Bloom_DisplayOptinForm($form_id);
}
//Thrive Leads
if (class_exists('ThriveLeads')) {
// Create a new lead group
$group_id = ThriveLeads_CreateLeadGroup($name);
// Create a new opt-in form
$form_id = ThriveLeads_CreateOptinForm($name, $group_id, $template_id, $headline, $subheadline);
// Display the opt-in form
echo ThriveLeads_DisplayOptinForm($form_id);
}
//WPForms
if (class_exists('WPForms')) {
// Create a new email opt-in form
$form_id = WPForms_CreateOptinForm($name, $template_id, $list_id);
// Display the email opt-in form
echo WPForms_DisplayOptinForm($form_id);
}
//SumoMe
if (class_exists('SumoMe')) {
// Create a new email opt-in form
$form_id = SumoMe_CreateOptinForm($name, $template_id, $list_id);
// Display the email opt-in form
echo SumoMe_DisplayOptinForm($form_id);
}
//Leadpages
if (class_exists('Leadpages')) {
// Create a new opt-in page
$page_id = Leadpages_CreateOptinPage($name, $template_id, $list_id);
// Display the opt-in page
echo Leadpages_DisplayOptinPage($page_id);
}