Friday, March 8, 2013

How to Create a Email Newsletter Manager using Wordpress and Feedburner



There are lots of altered means to acquaint with your users these days. RSS feeds, SMS, & sites like Twitter accept afflicted how we allege to our audience. But for my money, you can’t exhaust the claimed blow of an acceptable ol’ email newsletter.
Of advance befitting up a newsletter can yield effort, but in this tutorial I’ll appearance you how to use your approved Wordpress website accumulated with Feedburner to accomplish a simple email newsletter manager.
There are abounding committed and abundant email newsletter solutions on the market. This is not advised to alter them, but rather to action a simple way to email visitors of your claimed website or blog an annular up of updates and account after accepting to install new software or set up new systems.
What we are going to do is:
  1. Make a ‘Newsletter’ category in Wordpress
  2. Hide it from regular posts
  3. Make an RSS feed for that category
  4. Give that feed to Feedburner and use their email update service to deliver our newsletter.
This tutorial is based on the absence affair in Wordpress 3.5.1. If you are application an altered theme, some cipher may be in a hardly altered abode and you may accept a few added files, but the attempt are still the same.
Once you’re all set up, sending out an email newsletter will be as simple as autograph a blog post, so let’s get started!

Step 1 – The ‘Newsletter’ category

Now we need to create a new category in Wordpress named ‘Newsletter’. Sign in to your admin area and go to Post > CategoriesAdd New. For Category Name let’s choose ‘Newsletter’ and Category Slug will be ‘newsletter’ , Description will be Email Newsletter and click ‘Add New Category’.

With our Newletter category created, we need to get category ID. When we keep mouse on newsletter category we can see our mew category ID(945) part of the link as shown in the screenshot below:

Our new category ID id is 975. This number will probably be different for you, make a note of it.
For the last of this tutorial you will see this number represented by {My cat_ID}. Wherever you see {MY cat_ID}, replace this with your number.

Step 2 – Hiding the ‘Newsletter’ category

Now we should adumbrate this class abroad from our capital blog/site. Firstly we’ll adumbrate it from the class account that appears in the WordPress sidebar. A class will alone appearance in the aftereffect if it has at atomic one column assigned to it, accordingly the Newsletter class will not appearance until we address and broadcast a column for it.
Go your theme folder sidebar.php file (/wp-content/themes/theme-name/sidebar.php) and look for:
  1. wp_list_categories('show_count=1&title_li=<h2>Categories</h2>');  
Change this to:
  1. wp_list_categories('show_count=1&exclude={MY cat_ID}&title_li=<h2>Categories</h2>');  
This will exclude our created Newsletter category from showing up in the category list in our sidebar.

Step 3 – Hide Posts

Next, we wish to stop our newsletters from assuming up in our approved posts. Excluding categories from “The Loop” (where WordPress displays our posts) seems to be a bit problematic. After aggravating this way and that way, there were still problems with paging breaking, it artlessly not alive and sql errors. We wish to accumulate this adjustment as simple as accessible after resorting to plugins so we’ll use the afterward method:
Open up the following files in your WordPress theme:
  • index.php (/wp-content/themes/theme-name/index.php)
  • archive.php (/wp-content/themes/theme-name/archive.php)
  • search.php (/wp-content/themes/theme-name/search.php)
In each of the files, where you see the following code:
  1. <div class="post">...  
Now add this line just above it:
  1. <?php if (in_category('{MY cat_ID}')) continue; ?>  
so now our code in those 3 files will look like this:
  1. <?php if (in_category('{MY cat_ID}')) continue; ?><br>  
  2. <div class="post">... etc.  
We are cogent WordPress not to affectation any posts from our Newsletter category. Whilst this address is the atomic problematic, there is something that’s important to understand. Quoted from the WordPress documentation:
"Please agenda that even admitting the column is not getting displayed it is still getting counted by WordPress as accepting been apparent — this agency that if you accept WordPress set to appearance at a lot of seven posts and that two of the endure seven are from Class 3 again you will alone affectation 5 posts on your capital page. If this is a botheration for you, there is added complicated drudge you can apply declared in the Layout and Design FAQ or you can use query posts if you alone charge to exclude one class from the loop."
The above is also true of search results. However if you are sending out a newsletter about once a month, it shouldn’t be a real problem.
We also don’t want any posts in the ‘Newsletter’ category to show up in navigation when viewing single posts / permalinks. Open up single.php (/wp-content/themes/theme-name/single.php) and search.php (/wp-content/themes/theme-name/search.php) and change the following:
  1. <div class="navigation"><br>          <div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div><br>         <div class="alignright"><?php next_post_link('%link &raquo;') ?></div><br>        </div>  
to:
  1. <div class="navigation"><br>          <div class="alignleft"><?php previous_post_link('%link', '%title', FALSE, '{MY cat_ID}') ?></div><br>           <div class="alignright"><?php next_post_link('%link', '%title', FALSE, '{YOUR cat_ID}') ?></div><br>      </div>  

Step 4 – Hiding ‘Newsletter’ in our RSS

Now that we accept our class set up we can move on to the RSS augment that will ability our newsletter.
Just as we didn’t wish the “Newsletter” class to appearance in our aftereffect or in our posts, we aswell don’t wish it assuming up in our website’s approved RSS feed.
The url for your WordPress site’s RSS feed should be something like http://yourwpsite.com/?feed=rss2. To exclude our ‘Newsletter’ category we ‘add &cat=-{MY cat_ID}‘ to the end so it now reads http://yourwpsite.com/?feed=rss2&cat=-{MY cat_ID}.
In the file header.php (/wp-content/themes/theme-name/header.php), you should see a line that reads:
  1. <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />  
change this to:
  1. <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="http://yourwpsite.com/?feed=rss2&cat=-{MY cat_ID}" />  
If you already have your main WordPress feed running through FeedBurner, you’ll need to sign in to FeedBurner, go to ‘My Feeds’, choose your feed and go to ‘Edit feed details…’ and change the ‘Original feed’ option.

Step 5 – Creating our RSS feed!

Now we create an RSS feed for just the ‘Newsletter’ category by using the URL http://yourwpsite.com/?feed=rss2&cat={MY cat_ID} – this is now your newsletter’s RSS feed url.
That was easy!

Step 6 – Burning the ‘Newsletter’ feed

Now we have an RSS feed for our newsletter, sign in to FeedBurner and enter your newsletter’s RSS feed url into the ‘Start FeedBurning now’ form:
or ‘Burn a feed right this instant’:
FeedBurner form
Click ‘Next »’.
Give your newsletter a name and new url:
Naming your feed in FeedBurner
Click on ‘Activate Feed’. You can then add extra bits via ‘Next Step’ if you wish or ‘Skip directly to feed management’.

Step 7 – Turning the Feed into an Email Newsletter

Almost done! Once FeedBurner tells you that your feed is ready, click on ‘Publicize’ up the top:
Publicize navigation
then choose ‘Email Subscriptions’ on the left:
Leave the default settings and click ‘Activate’.
You will now be accustomed the ‘Subscription Anatomy Code’ or ‘Subscription Hotlink Code’ which allows your website visitors to assurance up for the newsletter. Decide if you’d like a anatomy or a link, archetype the adapted cipher and adhesive it into your site. The aftereffect ability is a acceptable abode to adhesive it for now. You could aswell add a ‘Sign up for the newsletter’ appellation aloft the cipher just to accomplish it clear.
The number of newsletter subscribers’ and their email addresses can be viewed in your FeedBurner account, under Publicize > Email Subscription. You cannot sign people up on their behalf, which is a good thing. Users must click on a verification link sent to their email address before they are signed up.

Step 8 – Sending out a newsletter

Now all the fiddly being is done, sending out a newsletter is as simple as publishing a column to the ‘Newsletter’ category.
What happens is that if you column to the ‘Newsletter’ category, the RSS augment we created for that class updates. This alerts the FeedBurner email account which grabs your amend and emails it out to your account subscribers.
When you broadcast a ‘newsletter’ post, the email is not beatific out beeline away, but at the end of that day. This can acquiesce you to adapt or accomplish adjustments to your mail-out afore it is sent.

0 comments:

Post a Comment