How to set up an RSS or MailChimp feed with IssueM

If you want to allow your readers to easily keep up-to-date with your latest articles then you are going to want to make use of RSS feeds, whether it’s simply providing a feed for adding to a reader or creating an RSS-driven campaign in MailChimp.

Finding the feeds for articles can be a little tricky though, so here’s what you need to know.

RSS feed of most recent articles

http://yourdomain/feed?post_type=article

This will list the most recently published articles by publish date1, regardless of issue.

RSS feed of most recent articles in a particular article category

http://yourdomain/article-categories/[category-slug]/feed

This will the most recently published articles for a particular category by publish date. The easiest way to get the URL is to go to Articles > Article Categories, hover over the category name and click View on the action menu. This will take you to the article category listing on the public site and all you need to do is add /feed to the URL in your browser’s location bar.

If you are using WordPress categories for your articles, then you can use the same technique but go to Posts > Categories instead. Remember, this will include posts as well as articles, so if you only want to include articles add /?post_type=article to the end of the URL.

Adding articles to your main RSS feed

Your site’s primary RSS feed (http://yourdomain/feed) will only include posts. If you want to include articles in the feed as well then you need to let WordPress know.

You can do this by adding the following code to the bottom of your theme’s functions.php file2:


// Add articles to main RSS feed.
function add_articles_to_main_feed( $query ) {
if ( $query->is_feed() && !isset( $query->query['post_type'] ) )
$query->set( 'post_type', array( 'post', 'article' ) );
return $query;
}
add_action( 'pre_get_posts', 'add_articles_to_main_feed' );

Providing an RSS feed for the current issue

Providing an RSS for a specific issue is easily achieved via the following URL:

http://yourdomain/feed/?taxonomy=issuem_issue&term=[issue-slug]

However, that is pretty limited and a more likely scenario is that you’ll want to provide a feed for the latest issue without having to know the slug. Good news, we can do that!

Add this code to the bottom of your theme’s functions.php2 file:


// Add current issue feed
function add_current_issue_feed( $request ) {
if ( isset( $request['taxonomy'] ) && $request['taxonomy'] == 'issuem_issue'
&& isset( $request['term'] ) && $request['term'] == 'current' ) {
$request['term'] = get_issuem_issue_slug();
}
return $request;
}
add_action( 'request' , 'add_current_issue_feed');

What this function does is intercept the page request and check if it contains taxonomy=issuem_issue&term=current. If it does, then it replaces current with the latest issue’s slug.

In affect, this creates one of those specific issue requests on the fly.

The latest issue RSS feed URL looks like this:

http://yourdomain/feed/?taxonomy=issuem_issue&term=current

Notes:

  1. The number of items (posts or articles) in a feed is controlled by the Syndication feeds show the most recent option in Settings > Reading
  2. Whilst you can edit your theme’s functions.php file, any changes will be lost if the theme is updated. The preferred method to add functionality to a theme is to create a child theme.