Shortcode for archive: Filters

From version 2.6, you can show archive of your newsletters right on your website.

All newsletters will be listed, except for:

  • Autoresponder (automatic newsletter sent after an even, like a new subscription)
  • Draft newsletters
  • Scheduled newsletters

Get the shortcode in the Settings

Go to MailPoet > Settings > Advanced tab and scroll down.

Click on the link "Geeky options", click on it.

Here you can select one or more lists of subscribers to whom your newsletters are sent.

Once you are done, copy the shortcode and paste anywhere you like on your site. 

The code provides 4 filters

  1. mpoet_archive_title (by default, title is empty)
  2. mpoet_archive_date
  3. mpoet_archive_subject
  4. mpoet_archive_no_newsletters (in case there is no newsletter. Default message is: "Oops! There are no newsletters to display.")

Example of using filters

/**
 * Filter "mpoet_archive_title": display custom title
 * @param string $title
 * @return string
 */
function my_mpoet_archive_title($title) {
    return $title. 'Awesome newsletters';
}
add_filter('mpoet_archive_title','my_mpoet_archive_title');

/**
 * Filter "mpoet_archive_date": add custom text
 * @param string $sent_at
 * @return string
 */
function my_mpoet_archive_date($sent_at) {
    return '(
	<strong>Great!</strong>) '.$sent_at;
}
add_filter('mpoet_archive_date','my_mpoet_archive_date',99);

	/**
 * Filter "mpoet_archive_subject": add custom text
 * @param type $subject
 * @return type
 */
function my_mpoet_archive_subject($subject) {
    return $subject. ' <== CLICK HERE';
}
add_filter('mpoet_archive_subject','my_mpoet_archive_subject',99);

The final result: