Customize your Confirmation and Unsubscribe pages

MailPoet adds a custom post type on your site that is used to show the subscription Confirmation page and the Unsubscribe page.

However in most cases, this custom post type will inherit the post template and will show undesired sections from your theme, like comments, trackback, social share icons, etc.

To change this behavior, you need to create two new specific pages for each of these two actions (Confirmation page and Unsubscribe page).

We are aware that some people don’t like the “Great, you’ll never hear from us again!” or “Yup, we’ve added you to our list. You’ll hear from us shortly.

Steps to customize your pages

1. Go to your Pages menu inside your WordPress Dashboard and click on “Add New”:

Add new page

2. First, let’s create a page for the Unsubscribe page:

New Unsubscribe page

Tip: Read more about Page Templates.

3. Second, repeat the same steps to create another new page for Confirmation page:

Add new Confirmation page

4. Go to MailPoet’s Settings page. On the Basics tab you’ll select the new Unsubscribe page that you have just created.

You can click on Preview to see how it’s going to look like with the new Page’s template from your theme. Save your settings.

Assigning the new Unsubscribe page

Here’s the preview of that page, notice that we intentionally left the comments section so that we can show you how to remove it:

The Unsubscribe Preview page

Here’s how we remove the comment’s section:

Quick edit Uncheck comments

Here’s how it looks like now, without the Comments section:

The new Unsubscribe page without comments

5. Still inside your Settings page from the MailPoet menu, go to the Signup Confirmation tab and change the page that will show up when your subscribers click on the link to confirm their subscriptions.

Don’t forget to Save your settings.

Changing the Confirmation Page

And here’s the new Confirmation page:

The new Confirmation page

 

6. Bonus! If you have a sharp eye, you probably thought: “Okay, but the old Unsubscribe page contained an Undo Unsubscribe link, how can I add it to this new Unsubscribe page?

The old Unsubscribe page

Here’s how to do it: add the following code to the bottom of your functions.php file that exists inside your current theme’s folder (wp-content/themes/your-theme/).

/**
 * function to return an undo unsbscribe string for MailPoet newsletters
 * you could place it in the functions.php of your theme
 * @return string
 */
function mpoet_get_undo_unsubscribe(){
 if(class_exists('WYSIJA') && !empty($_REQUEST['wysija-key'])){

 $undo_paramsurl = array(
 'wysija-page'=>1,
 'controller'=>'confirm',
 'action'=>'undounsubscribe',
 'wysija-key'=>$_REQUEST['wysija-key']
 );

 $model_config = WYSIJA::get('config','model');
 $link_undo_unsubscribe = WYSIJA::get_permalink($model_config->getValue('confirmation_page'),$undo_paramsurl);

 $undo_unsubscribe = str_replace(
 array('[link]','[/link]'),
 array('<a href="'.$link_undo_unsubscribe.'">','</a>'),
 '<p><b>'.__('You made a mistake? [link]Undo unsubscribe[/link].',WYSIJA)).'</b><p>';

 return $undo_unsubscribe;
 }
 return '';
}

add_shortcode('mailpoet_undo_unsubscribe', 'mpoet_get_undo_unsubscribe');

Then add this shortcode to your newly created Unsubscribe page: [mailpoet_undo_unsubscribe]

New shortcode

 

Tip: If you are using a custom Page Template you can “echo” the Undo link directly into your .php template:

echo mpoet_get_undo_unsubscribe();

Here’s how it’s going to look like now:

New unsubscribe page

If you have other questions, get in touch with us!

10