Quick tips with integrating into wordpress

Thought someone would find the below helpful.

1) Adding a subscribe form with just the built in text widget:
To get a form, go to your list in campaign mointor, and click “Grow your audience”. Next, click “Copy/paste a form to your site”. Select the list(s) that you want, and then click generate code.  This will provide the form code to put into your blog. You can later customize the settings like email confirmation, thank you note, etc.

2) Send an email when post published
As I am newer to Wordpress, I had to add the api wrapper into the themes directory to access. Now use the “create a draft campaign” and “Sending a draft campaign  to send an email. This code should go into a functions.php:

function email_alert()  {
    //campaign monitor code
}
add_filter ( 'publish_post', 'email_alert' );

Resource:
WordPress.org support: Publish actions

EDIT: Stop publishing new alert on update:
The following post was helping in this.

The function should be:

function email_alert()  {
    if( ( $_POST['post_status'] == 'publish' ) && ( $_POST['original_post_status'] != 'publish' ) ) {
      //campaign monitor code
    }
}
add_filter ( 'publish_post', 'email_alert' );
roshodgekiss roshodgekiss, 4 years ago

Thank you so much for sharing this, jtesolin    - this is so useful! Love your work :)


Get in touch with us on Twitter: http://twitter.com/campaignmonitor
We're also on Facebook: http://facebook.com/campaignmonitor
jtesolin jtesolin, 4 years ago

No problem, and thanks.

Just found another alert that someone with more WordPress savvy can fix - when you update a post it will send the notification as well, even its its already been published.

See why 200,000 companies worldwide love Campaign Monitor.

From Australia to Zimbabwe, and everywhere in between, companies count on Campaign Monitor for email campaigns that boost the bottom line.

Get started for free