WordPress.org

Ready to get started?Download WordPress

Forums

Small solution: Combined RSS feed (post + comments) (4 posts)

  1. kathmann
    Member
    Posted 7 years ago #

    As I couldn't find a hack or plugin that did this easily, I whipped up a small PHP script today that builds an RSS (RSS2) feed that contains the latest 10 posts and their comments in one simple feed.

    DISCLAIMER: I did some basic tests of this code on a friend's blog, and it checked out ok...which doesn't mean it's 100% guaranteed fault free. Also the code is quite quick 'n' dirty, feel free to adapt and use in whatever way you want, but please give credit, my ego needs feeding too :-)

    GET IT:

    1. Download the source code here.

    2. Save the file with extension '.php' (so change the '.txt' extension), and upload to the root of your WordPress directory.

    3. Access the url to the file (i.e.: http://www.yoursite.com/wp-rss2-combined.php) using your favorite RSS reader to test and verify it's working.

    If you wish to change the number of posts shows in this feed, open the file in a text or web editor, and find these lines near the top of the file:

    // how many posts to show?
    $limit = 10;

    Change the number to whatever you want and hey presto!

    Do enjoy, comments are welcome.

  2. kathmann
    Member
    Posted 7 years ago #

    Small update: feed now also shows author names with the comments, and link (if entered).

  3. andyhoyland
    Member
    Posted 7 years ago #

    Kathmann - I like this little code... thank you very much. BUT at the moment I only have the feed showing my posts and not my comments. Can you think of anything I may have done wrong?!

    Andy.

  4. andyclarson
    Member
    Posted 7 years ago #

    this sounds great and is exactly what i'm looking for, but i can't download it at the moment as your site is down :(

Topic Closed

This topic has been closed to new replies.

About this Topic