[Tutorial #28] Content Sharing -2: Email Subscription and Feed

[Tutorial #28] Content Sharing -2: Email Subscription and Feed

Introduction

In last tutorial we introduced two plugins to do (1)  SEO and (2) social media auto-publish. Here we continue introducing the  third content sharing technique: Email subscription via MailChimp.

MailChimp Service

Mailchimp is an online email campaign service (with a free pricing plan). Website owners can create email campaigns to get subscribers and automatically send them email updates.

mailchimp home page

Account Registration

To use MailChimp you have to first create an account. You must have a domain name to register due to anti-spam regulation. It is also recommended that you create an email acount that ties to your domain.

After entering your domain MailChimp will ask to verify your domain. For me I have to further set some DNS records outlined in this article. See this tutorial for DNS record configuration.

Creating a Campaign

Once you register an account you can start create campaigns by clicking top left menu icon and then the campaigns tab. For ModernBlackHand we use an RSS campaign that gets post updates via wordpress RSS Feed.

mailchimp rss campaign

Then you have to specify your wordpress’ RSS url and the frequency and time your campaign send out updates. Usually wordpress’ rss url is http://your_domain/index.php/feed but plugins may change it.

Mailchimp set rss url frequency

RSS url and frequency.

You can check your rss url by typing it in the browser. It should look something like this, similar to a web page source code:

rss url in browser

RSS url shown in the browser.

Then it will ask to use a list for the campaign. A list is simply a table to store subscriber information. The default list example should work.

mailchimp list setup

Then you enter some basic campaign information.

Mailchimp campaign basic info

Then select an email style, and customize its content display.

Mailchimp email format

Mailchimp mail content

Confirm and review your setting, then hit “Start RSS” to start the campaign!

MailChimp for WP Plugin

Now the campaign is ready to send email updates, the next step is to configure your site to get subscribers. For MailChimp there is the MailChimp for WP plugin.

MailChimp for WordPress plugin

After installing and activating the plugin you have to:

  1. Link to your MailChimp account.
  2. Create a sign-up form and configure error messages.
  3. Include the codes in your wordpress template, like footer.php.

Link to Your MailChimp Account

You need to find out what your API key is to let wordpress connects to MailChimp. Simply click “get your API key here” link in the MailChimp API Settings tab. You might need to create one the first time.

MailChimp get api

Save it and if it is successful it will display a green “CONNECTED” text.

Create Sign Up Form

Then click on the Forms tab. There you can determine:

  1. The form’s HTML.
  2. Prompt and error messages.
  3. Sign-up behaviors.
  4. CSS Style

Once you are done, click <>Get shortcode just below the form name to get the wordpress code that tells wordpress where to insert the form.

MailChimp plugin Form

Include the shortcode in your wordpress template

For me I put it inside footer.php inside a modal. The code segment is as follows (get the complete file on my Github):

The codes have the usual three <div> tags with classes modal, modal-dialog and modal-content (line 3-5). See this tutorial for using modals.

Line 7-16: modal-header

Here we use a header to explain the subscription form.

Line 18-24: modal-body

Here is the main modal body (the subscription form), and we put the shortcode here.

Line 28-34: disclaimer

It is good practice to explain to your viewers that you repsect their privacy and won’t abuse their information.

Test Your Subscription!

You have completed setting up email subscription for your site! Open the form, enter your own email, and check your mailbox to test it!