WordPress.org

Support

Support » How-To and Troubleshooting » How to create RSS feed that includes multiple categories?

How to create RSS feed that includes multiple categories?

  • gust0208
    Member

    @gust0208

    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

Viewing 3 replies - 1 through 3 (of 3 total)
  • David Sader
    Participant

    @dsader

    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

    spabav
    Participant

    @spabav

    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.

    Wowww that simpel…. it helped me anyways 🙂 ty!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to create RSS feed that includes multiple categories?’ is closed to new replies.