Build a ‘WordBurner’ Email Newsletter Manager using WordPress and FeedBurner

There are lots of different ways to communicate with your users these days. RSS feeds, SMS, & sites like Twitter have changed how we speak to our audience. But for my money, you can’t beat the personal touch of a good ol’ email newsletter.

Of course keeping up a newsletter can take effort, but in this tutorial I’ll show you how to use your regular WordPress website combined with Feedburner to make a simple email newsletter manager.

There are many dedicated and great email newsletter solutions on the market. This is not intended to replace them, but rather to offer an easy way to email visitors of your personal site or blog a round up of updates and news without having to install new software or set up new systems.

What we are going to do is:

  1. Create a ‘Newsletter’ category in WordPress
  2. Hide it from regular posts
  3. Create 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 default theme in WordPress 2.5.1. If you are using a different theme, some code may be in a slightly different place and you may have a few extra files, but the principles are still the same.

Once you’re all set up, sending out an email newletter will be as easy as writing a blog post, so let’s get started!

Step 1 – The ‘Newsletter’ category

First of all we create a new category in WordPress called ‘Newsletter’. Sign in to your admin area and go to Manage > Categories – click Add New. For Category Name let’s choose ‘Newsletter’ and Category Slug will be ‘newsletter’ and click ‘Add Category’.

Adding a category in WordPress

With our Newletter category created, we need to get its ID. Since WordPress version 2.5, seeing a category’s ID has become a little tricky, the best way to see it is to hover over the category in Manage > Categories and look at the status bar in your browser for the cat_ID part of the link as shown in the screenshot below:

Category ID link

In this example, our category ID id is 6. This number will probably be different for you, make a note of it.

For the rest of this tutorial you will see this number represented by {YOUR cat_ID}. Wherever you see {YOUR cat_ID}, replace this with your number.

Step 2 – Hiding the ‘Newsletter’ category

Now we should hide this category away from our main blog/site. Firstly we’ll hide it from the category list that appears in the WordPress sidebar. A category will only show in the sidebar when it has at least one post assigned to it, therefore the Newsletter category will not show until we write and publish a post for it. But we don’t want that to happen, so…

Open up your theme’s sidebar.php file (/wp-content/themes/your-theme-name/sidebar.php) and look for:

wp_list_categories('show_count=1&title_li=<h2>Categories</h2>');

Change this to:

wp_list_categories('show_count=1&exclude={YOUR cat_ID}&title_li=<h2>Categories</h2>');

This will exclude our Newsletter category from showing up in the category list in our sidebar. (Ref.)

Step 3 – Hide Posts

Next, we want to stop our newsletters from showing up in our regular posts. Excluding categories from ‘The Loop‘ (where WordPress displays our posts) seems to be a bit problematic. After trying this way and that way, there were still problems with paging breaking, it simply not working and sql errors. We want to keep this method as simple as possible without resorting to plugins so we’ll use the following method: (Ref)

Open up the following files in your WordPress theme:

  • index.php (/wp-content/themes/your-theme-name/index.php)
  • archive.php (/wp-content/themes/your-theme-name/archive.php)
  • search.php (/wp-content/themes/your-theme-name/search.php)

In each of the files, where you see the following code:

<div class="post">...

add this line just above it:

<?php if (in_category('{YOUR cat_ID}')) continue; ?>

so now our code in those 3 files will look like this:

<?php if (in_category('{YOUR cat_ID}')) continue; ?>
<div class="post">... etc.

We are telling WordPress not to display any posts from our Newsletter category. Whilst this technique is the least problematic, there is something that’s important to understand. Quoted from the WordPress documentation:

"Please note that even though the post is not being displayed it is still being counted by WordPress as having been shown — this means that if you have WordPress set to show at most seven posts and that two of the last seven are from Category 3 then you will only display five posts on your main page. If this is a problem for you, there is more complicated hack you can employ described in the Layout and Design FAQ or you can use query_posts if you only need to exclude one category from the loop." (Ref)

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/your-theme-name/single.php) and search.php (/wp-content/themes/your-theme-name/search.php) and change the following:

<div class="navigation">
<div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>
<div class="alignright"><?php next_post_link('%link &raquo;') ?></div>
</div>

to:

		<div class="navigation">
<div class="alignleft"><?php previous_post_link('%link', '%title', FALSE, '{YOUR cat_ID}') ?></div>
<div class="alignright"><?php next_post_link('%link', '%title', FALSE, '{YOUR cat_ID}') ?></div>
</div>

(Ref 1, 2)

Step 4 – Hiding ‘Newsletter’ in our RSS

Now that we have our category set up we can move on to the RSS feed that will power our newsletter.

Just as we didn’t want the ‘Newsletter’ category to show in our sidebar or in our posts, we also don’t want it showing up in our website’s regular 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=-{Your cat_ID}‘ to the end so it now reads http://yourwpsite.com/?feed=rss2&cat=-{Your cat_ID}.

In the file header.php (/wp-content/themes/your-theme-name/header.php), you should see a line that reads:

<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />

change this to:

<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="http://yourwpsite.com/?feed=rss2&cat=-{Your 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={Your 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:

FeedBurner 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:

Email Subscriptions

Leave the default settings and click ‘Activate’.

You will now be given the ‘Subscription Form Code’ or ‘Subscription Link Code’ which allows your site visitors to sign up for the newsletter. Decide if you’d like a form or a link, copy the appropriate code and paste it into your site. The sidebar might be a good place to paste it for now. You could also add a ‘Sign up for the newsletter’ title above the code just to make 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 stuff is done, sending out a newsletter is as simple as publishing a post to the ‘Newsletter’ category.

What happens is that when you post to the ‘Newsletter’ category, the RSS feed we created for that category updates. This alerts the FeedBurner email service which grabs your update and emails it out to your list subscribers.

When you publish a ‘newsletter’ post, the email is not sent out straight away, but at the end of that day. This can allow you to edit or make adjustments to your mail-out before it is sent.

Here is how the newsletter looks in Gmail:

Newsletter example

Note that in this test scenario my newsletter is called ‘WP Dev’, that’s just the title of the WordPress blog I set up to test this, the newsletter will pick up the title of your WordPress site. It says ‘Newsletter’ as that is what I called my newsletter category.

I hope this tutorial eases any newsletter pains you may be having. Enjoy!

Final Notes

  • You can test this all out by signing up and posting a newsletter to yourself before putting the sign up form on your site.
  • Be sure that your RSS feed is set to show ‘Full Text’ under Settings > Reading in the WordPress admin area:
    RSS feed options in WordPress

    Otherwise people will just receive a snippet of your newsletter instead of the full thing.

  • You can follow this method for multiple categories, often by seperating category IDs with commas. I haven’t gone into this during this tutorial but you can find out more by clicking the ‘Ref’ links you see in this article.
  • By their nature, RSS feeds are very adaptable. If you come up with an interesting take or build on this technique please leave a comment about it.
  • If you wanted to go a newsletter crazy, you could go as far as setting up a WordPress blog just for newsletters, but that’s another story.
  • As mentioned at the start, this was tested on WordPress 2.5.1 using the default theme. Your code may differ somewhat depending on the theme you are using but the principles remain the same.
  • It seemed that the trickiest part in creating this tutorial was getting WordPress so successfully ignore a category without it having a knock-on effect or breaking other parts of the site. There is a plug-in called Ultimate Category Excluder that might be worth a look but I have not tried or tested it.

Tags: Wordpress
Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • http://www.rajdash.com/ Raj Dash

    J. Daniels: I can’t see your XML file, but my question is how is it created? The two URLS at the bottom of your email are in HTML document format, so if you’re using them, that’s the problem.

    Generally speaking, when you have a site where the content is not automatically appended to an existing RSS/ Atom feed format file, you have two choices:

    (1) Scrape your site using “screen” scraper software (too complicated) and generate the XML feed file (one time).
    (2) Take your content pages and using an XML editor (or good HTML editor), manually create the initial XML feed file (one time).

    Once that initial file has been created, in an appropriate feed format, you can “burn” it in Feedburner. But each time you create new content for the site, you will have to add it to the XML feed file.

    Hope that helps.

    • http://xentek.net/ Eric Marden

      #2 is error prone if you don’t update the RSS correctly. I’ve tried this and its not worth the effort.

  • Pingback:   Table Of Contents Of Wordpress Tutorials, Helps, Tips and Tricks by aComment.net

  • Pingback: Marketing & Wordpress: 15 Top Wordpress plugins | CarbonGraffiti - Email and Online Marketing

  • http://www.davidlau.org David Lau

    Well Done!
    But can you tell me how to hide the posts from this category in the “Latest posts” at the sidebar?
    Thanks!

  • http://www.davidlau.org David Lau

    some code like this in the sidebar:
    < ?php get_archives(‘postbypost’, ’10′, ‘custom’, ”, ”); ?>

  • http://rollyo.com/hentai-graduit graduit hentai world

    hentai graduit one hentai graduit film

  • http://www.windows7themes.com Windows Themes

    i can’t wait to implement it on my wp sites. Thank you !

  • Pingback: David Lau dot ORG

  • http://www.strangedesign.net Chris

    First let me say without this post I was sort of screwed for a client’s site making the newsletter easy to do from within the wordpress site itself. But I think I can help make this post A LOT shorter. I found this plugin:

    http://wordpress.org/extend/plugins/advanced-category-excluder/

    Which works great in simple clicking a checkmark to exclude the category anywhere from just the homepage, the archive, the rss feed (posts and comments), as well as site search. I have installed it on a 2.6.2 implementation and it is working great.

    One note, it only seems work on the RSS2.0 feed and not the Atom or RSS feeds but I simple replaced those lines in my template to only us the RSS2.0 feed.

    Thanks Again Paul!!!!

    -Chris
    DJ and Host
    The Half Hour Comedy Hour
    http://www.strangedesign.net

  • http://www.bryanbarker.com Bryan

    Awesome!

    Although, is there no way to format any html into the newsletters?

  • http://www.juegosflash.cl Mario

    Muy buen dato, lo utilizaré para mi blog personal.
    Muchas Gracias.

  • http://aravindjose.com/blog/ Aravind Jose T.

    Thanks for this great, simple and well-documented tutorial.

  • http://godrops.com Jason

    Awesome tip! Thanks! Newsletters on the Cheap — for programmers :)

  • http://www.todoslot.es/ ninco

    Magnífico tutorial.
    Os dejo esta web, que me parece una herramienta excepcional para analizar links.
    linkdiagnosis.com
    Saludos

  • http://www.smartadvise.info Blog Traffic 101

    Superb post. Though I’ll have to print and go through the codes once again and try it out. Thx for sharing it.

  • Pingback: 7 modi per utilizzare Wordpress in modo davvero originale | Area3000

  • Pingback: The Twenty Most Earth-Shattering Tutorials on NETTUTS! - NETTUTS

  • http://etomco.com TK

    anyone know of a good means of collecting email address in wordpress? A form perhaps?

  • http://www.oceangray.net oceangray

    very useful. thanks.

  • http://xiaop.net xiaop

    very great! thanks

  • Pingback: GotChance - A Geek’s Blog » Blog Archive » 10 Sites You Can Develop With Wordpress

  • Pingback: The 7 Weirdest and Wackiest Uses for WordPress « LocalLab : Foire aux Infos

  • Pingback: Ce poti face cu Wordpress | Interfete Web

  • http://www.as7ap4you.com kareem

    this is wonderful tutorial i will put acopy of this lesson on
    my site here
    http://www.as7ap4you.com

  • Pablo DiCiacco

    Question:
    I see my feeds from the category and have subscribe to test it. I receive a confirmation, but not the newsletters. (?)
    I used your php edits, but also have ACE (advanced category excluder). Is this a conflict which may be blocking something somewhere on the feed burner end as far as subscriptions being sent?
    Thanks

  • http://www.BusinessExcellence.me Ala7lam

    One of the best tutorials I ever read about WordPress.

    Thanks!

  • Pingback: Wordpress + Feedburner = Email Newsletter Manager - WebLoggers WebLogging Forum

  • http://parisvega.com Paris Vega

    Creative use of categories. Still trying to decide wether to make a seperate install called newsletter like Ibrahim Cesar mentioned or apply your technique.

  • http://www.ikbengelukkig.nl Esther

    Love it! I am gonna use this for sure!

  • Pingback: How to Create a Wordpress Theme from Scratch: Part 2 « ” Blog-nya Erwin prasetyo “

  • http://rahmrt235.blogspot.com social browsing web

    web social personal

  • Pingback: 使用 WordPress 和 Feedburner 打造自己的 Newsletter | sqboa Blog

  • Pingback: The 7 Weirdest and Wackiest Uses for WordPress

  • http://www.seonet.cl Rcardo Tapia

    genial gracias por la información

  • http://yogalistic.com Lyi C

    Thanks! Just what I was looking for

  • http://www.saumendra.blogspot.com Saumendra

    Great Paul,

    The idea on messing two technologies is really appreciable. Your step by Step approach is best for testing and having 100% results

  • Pingback: A Collection of 15 Useful WordPress Tutorials for 2008 » Papertree Design

  • Brigitte

    How do you manage your list on feedburner? How do you place an opt in and opt out option that is managed through feedburner?

  • http://sackclothstudios.com Alex

    That’s interesting. I didn’t know such a thing was possible!

  • http://blog.iws.com.ve curdaneta

    Great tutorial, really useful!

  • http://www.timothybsmith.com Tim Smith

    Great Post!! Totally need this!

  • Gaëtan

    Great tutorial indeed!! Really smart!

    I tried in sidebar.php (theme file)

    From:

    Catégories

    To:

    Catégories

    //** just added =>&exclude=16& **//

    and the categorie ID is 16.

    But Nothing happen…I’m certainly wrong, but I can’t find my mistake…!! Do you have any idea?

    (WordPress 2.7)

    Thanks a lot!;-)

  • http://ekbdesigns.com Elizabeth K. Barone

    All I needed was something simple so that I could update a site’s visitors, but everything I looked at was more than I wanted or had restrictions. I knew you could set up a mailing list on Feedburner, but didn’t want to email out RSS posts. This is so much better. Thank you so much for sharing this!

  • http://www.rcthegreatblog.com Rahul Chowdhury

    Wow, this tutorial is good. But I use Email Subscription with my regular feeds. Its way more easy than this, and does it job too!

  • Pingback: Build a ‘WordBurner’ Email Newsletter Manager using WordPress and FeedBurner - NETTUTS « You and I Skills

  • http://www.buzzi-studio.com strony internetowe szczecin

    very usefull tut

  • daniel lench

    using Category Visibility-iPeat Rev from: http://wordpress.org/extend/plugins/category-visibility-ipeat/

    it works great wp 2.7+

  • http://www.danosongs.com DanoSongs

    I have been doing this for a while but the email was coming out weird. The “rss2″ part is the key to formatting the email right when delivered by feedburner. Thanks.

    The general blogging and webmaster population has no idea about this. If they did it would put allot of email newsletter delivery companies out of business.

    Its a killer combination.

    Dan-O
    http:\\www.danosongs.com

  • Pingback: Build a ‘WordBurner’ Email Newsletter Manager using WordPress and FeedBurner | CgBaran Tuts

  • http://tuts.cgbaran.com CgBaran Tuts

    Great tutorial thanks