WordPress.org

Support

Support » How-To and Troubleshooting » RSS Feed for a page in wordpress?

RSS Feed for a page in wordpress?

  • 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.

Viewing 14 replies - 1 through 14 (of 14 total)
  • 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

    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.

    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);
    else:
    // WP original code
    $updated = mysql2date($date_format, get_lastpostmodified('GMT'), false);
    endif;

    and then inside RSS channel:

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

    looks like a patch for trac! 😉

    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.

    You may want to review that “static” thing… 🙂
    http://www.transycan.net/blogtest/2007/01/23/how-pages-are-different-in-wp-21/

    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.

    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]
    [Content]

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

    Any thoughts?

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

    so my urls are:
    http://www.mydomain.com/page1/page2/feed/atom/

    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.

    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

    Thx Sam! that was a deal breaker for upgrading.

    best,
    shua

    This bug got fixed in 2.2, apparently.

    .. Just what I was after. Handy.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘RSS Feed for a page in wordpress?’ is closed to new replies.
Skip to toolbar