WordPress.org

Ready to get started?Download WordPress

Forums

Creating Custom RSS Feed (8 posts)

  1. Chrisber
    Member
    Posted 5 years ago #

    My blog contains articles on a wide variety of subjects in about a dozen categories. I am trying to figure out a way to create multiple customized RSS feeds that only include content from certain categories to feed different aggregator sites. I'm not talking about a single feed for each category, but 3 or 4 different feeds that each contain a different combination of categories. For example:

    Feed 1: include all categories
    Feed 2: include category 3-7-8-11
    Feed 3: include category 1-2-3-7-10

    I was looking at the advanced category excluder plugin thinking it might be helpful, but I didn't see much in the way of documentation on the site.

    Any ideas or suggestions would be most appreciated. On a scale of 1 to 10, my php skill level is only about a 1.

    Thanks

  2. WordPress will create custom feeds on-the-fly for you if you provide additional query arguments:

    <a href="http://yoursite.com/feed/?cat=3,7,8,11">Feed 2</a>
    
    <a href="http://yoursite.com/feed/?cat=1,2,3,7,10">Feed 3</a>

    Obviously, modify the domain to match the root of your WP site (which, if running in a subdirectory, should also be included: i.e. http://your-real-domain.com/wordpress/feed/).

  3. Chrisber
    Member
    Posted 5 years ago #

    Thanks coffee2code. I did some more research after posting this yesterday and came across several different solutions. I will give it a try this weekend.

  4. collision_bend
    Member
    Posted 5 years ago #

    How about creating an RSS feed from a sidebar widget's content? I have a widget that creates a new statement in a div in my sidebar; it changes every night at midnight and remains there all day. The content statement comes from a flat text file, not from the WP loop. I'd like to create a separate RSS feed simply for this. (Everything I have seen relies on the content being within the Loop.)

    A good example of what I want to to can be seen at meyerweb.com, the Excuse of the Day.

    Suggestions?

  5. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    Adding a feed can be done in a plugin fairly easily.

    First, you create a function to output your feed. Like so:

    <?php
    function my_feed_function() {
    header('Content-Type: text/xml; charset='.get_option('blog_charset'), true);
    ?>
    <rss version="2.0">
    ... blah blah, output your feed content here however you like...
    </rss>
    <?php
    } // end of function

    Then, the key part. Give your feed a name and call the add_feed function:
    add_feed('myfeed','my_feed_function');

    Then by somebody can go to your site's /feed/myfeed to get your feed (or ?feed=myfeed, if you use default permalinks).

  6. cam_r_on
    Member
    Posted 5 years ago #

    I would like to add an RSS function to the Events plugin I'm using.
    http://meandmymac.net/plugins/events/

    Otto42, this seems to be what you are describing, but I'm not clear on how to implement you instructions.

    Thanks

  7. TheLeggett
    Member
    Posted 5 years ago #

    The solution Coffee2Code provided no longer works. WordPress 2.7 has this url redirect to only a feed for the first category.

    Is there a new way to do this?

  8. RocketPopScott
    Member
    Posted 5 years ago #

    Agreed! Is there another way to easily create an RSS feed from a category (I'm already excluding this category with another plug-in, but can't find an easy way to create a separate RSS feed). Any ideas?

Topic Closed

This topic has been closed to new replies.

About this Topic