RSS Feed for a page in wordpress? (15 posts)

  1. nortypig
    Posted 9 years ago #

    Is it possible in wordpress to create an rss feed for a page? I have a restaurant menu page and wonder if it is possible in WordPress to have an RSS feed pick up automatically when changes are made to the menu?

    Ideally I would not wish to manually write an rss feed for this if wordpress can handle it in-house.

    If anyone can answer this I'd greatly appreciate the feedback. Thanks.

  2. Austin Matzko
    Posted 9 years ago #

    If you're using permalinks, by default appending 'feed' to the permalink for that page should give you the feed for that page.

    So if the page link is example.com/page the feed will be example.com/page/feed

    If you're not using permalinks, append &feed=rss

  3. Sam_a
    Posted 9 years ago #

    I'm working on the very same thing.

    There's a big problem with the date -- WordPress sends Last-Modified and ETag headers (in wp-blog-header.php) for the feed using the date of last post modified, not the modified date of the Page represented in the feed. Same thing for the feed pubDate and modified elements.

    In my case, I have all Pages, no posts, so my /page/feed is sent with Last-Modified: 1970 every time... so it never appears to be updated! :(

    Kind of a bug.

  4. Sam_a
    Posted 9 years ago #

    This fixes part of it.

    In wp-rss2.php, after $more = 1, add:

    $date_format = 'D, d M Y H:i:s +0000'; // RSS
    if ( is_page() || is_single() ):
    foreach ($posts as $post);
    $updated = mysql2date($date_format, $post->post_modified_gmt, false);
    $last_modified = mysql2date('D, d M Y H:i:s', $post->post_modified_gmt).' GMT';
    $etag = md5($last_modified);
    // replace headers already sent in wp-blog-header.php
    header("Last-Modified: $last_modified", true);
    header("ETag: $etag", true);
    // WP original code
    $updated = mysql2date($date_format, get_lastpostmodified('GMT'), false);

    and then inside RSS channel:

    <lastBuildDate><?php echo $updated; ?></lastBuildDate>

  5. davidchait
    Posted 9 years ago #

    looks like a patch for trac! ;)

  6. Sam_a
    Posted 8 years ago #

    I eventually got this working but I think I had to add OR post_status = 'static' to the query in function get_lastpostmodified (in /wp-includes/functions.php)... I don't quite remember.

  7. moshu
    Posted 8 years ago #

  8. Sam_a
    Posted 8 years ago #

    Yes, this was a 1.5 hack, now deprecated. :)

    It looks like 2.1's get_lastpostmodified function will now include Pages so this won't be necessary.

  9. shua
    Posted 8 years ago #

    Trying to follow along here...

    This is my issue: I need to be able to serve 1 page item thru rss (or atom).

    in 2.0.5 my url returns exactly what I would like to see:

    [My Page Name]

    in 2.1 my url returns:
    Comments on: [My Page Name]

    Any thoughts?

  10. shua
    Posted 8 years ago #

    Also, I am using permalinks to display Date and name based urls.

    so my urls are:

  11. Sam_a
    Posted 8 years ago #

    I noticed this too.

    Under 2.0.x, /page/feed returns a feed for the page contents, but under 2.1, it returns a comments feed for the page -- which is always empty, because Pages have no comments.

  12. Sam_a
    Posted 8 years ago #

    Made a quick plugin that seems to fix it: WordPress now uses wp-rss2 template again instead of the comments one.

    Page feed plugin for WordPress 2.1.x

  13. shua
    Posted 8 years ago #

    Thx Sam! that was a deal breaker for upgrading.


  14. Sam_a
    Posted 8 years ago #

    This bug got fixed in 2.2, apparently.

  15. landscribe
    Posted 8 years ago #

    .. Just what I was after. Handy.

Topic Closed

This topic has been closed to new replies.

About this Topic