WordPress.org

Ready to get started?Download WordPress

Forums

How to create RSS feed that includes multiple categories? (4 posts)

  1. gust0208
    Member
    Posted 3 years ago #

    Hello everyone,

    I have done quite a bit of searching, but unable to find a solution to my problem. I am trying to create a RSS feed that includes multiple categories in feed (using WordPress 3.1). In 2.7 and before you could put something similar to:
    http://www.mtgcast.com/?cat=15,16&feed=rss2

    But this does not seem to be working. What would be the correct syntax for the RSS link to include multiple categories?

    Thank you for your time and help.

    Cheers,
    Tom

  2. David Sader
    Member
    Posted 3 years ago #

    Here's 3 steps I just tried that appear to work:

    First add this to your theme's functions.php

    <?php
    function do_feed_custom() {
        $cats = "15,16";
        query_posts( array( 'cat'  => $cats, 'posts_per_page' =>20 ) );
        load_template( TEMPLATEPATH . '/custom-cat-rss2.php' );
    }
    add_action( 'do_feed_custom', 'do_feed_custom' );
    ?>

    Second,
    copy'n paste the entire and exact contents of /wp-includes/feed-rss2.php into a new file named custom-cat-rss2.php in the same folder as your functions.php from the first step.

    Finally, your feed is ready at

    http://www.mtgcast.com/?feed=custom

  3. spabav
    Member
    Posted 3 years ago #

    Gust,

    the syntax has changed a bit, but it remains to be just a simple callup line.

    Now just call:

    http://www.yourdomain.com/?feed=rss&cat=15,16

    will add both categories 15 and 16 to your feed.
    No functions necessary.

    Hope it helps.

  4. Martend
    Member
    Posted 3 years ago #

    Wowww that simpel.... it helped me anyways :) ty!

Topic Closed

This topic has been closed to new replies.

About this Topic