Support » Fixing WordPress » RSS feed of 1.5 pages?

  • Hey… a friend showd me how to use WP 1.5’s new “pages” feature to save me from having to do a second install of WP. It’s all working perfectly, except that I want my new pages to show up in my RSS. is that possible? Doesn’t really matter if it’s in my main RSS or on it’s own, but I would like to have RSS.

    (a brief explanation of the content: I am using pages for something of a category. A feature on my site that I update monthly. But I have to put it in pages, not categories, ’cause I’m using a different template for it.)

Viewing 15 replies - 1 through 15 (of 22 total)
  • ?page_id=100&feed=rss2

    -or-

    ?pagename=PAGE&feed=rss2

    -or (with custom permalinks) –

    /PAGE/feed/

    Offhand I’m not sure how one could pull a Page into ones main rss feed, since Pages are handled outside the standard post loop.

    hey man, thanks for the quick response. Unfortunately, I’m not sure what exactly that is you’re giving me… is that what I would put in the rss link? For rss for that specific page?

    If I’m understanding that correctly, that’s not really what I’m looking to do. I’m not looking for page-specific rss. I’m wanting an rss feed that will reflect when I create a new page – just like it would when I create a new post.

    It goes:

    http://YOURWEBSITE/?page_id=100&feed=rss2

    -or-

    http://YOURWEBSITE/?pagename=PAGE&feed=rss2

    -or (with custom permalinks) –

    http://YOURWEBSITE/PAGE/feed/

    “I’m wanting an rss feed that will reflect when I create a new page – just like it would when I create a new post.”

    And as I mentioned, I don’t know offhand how this would be accomplished, since Pages exist outside of the post chronology features in WordPress that allow ones feed to “discover” new entries.

    i’m looking to do this as well, I’m about to set up a site using alot of Pages, and if there is no way to get rss on those, that blows my whole site strategy

    could this be a plugin?

    in light of what kafkaesqui said about the loop it may be difficult, but what would the alternative be? to roll your page feeds by hand?

    seems a shame to have pages but no integrated rss

    throwing a hail mary bump~

    Moderator Ryan Boren

    (@ryan)

    WordPress Dev

    Pages aren’t posts. Consider using a category.

    Implementing this in a plugin is possible. Maybe someone will provide one.

    Or perhaps someone will just provide a small rewrite to the RSS file (back up any files before editing them)…

    Add this to your wp-rss2.php (or wp-rss.php, wp-atom.php and wp-rdf.php, depending on what formats you want to support with this), somewhere before The Loop occurs:

    <?php
    if(isset($_GET['pages']))
    $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static'");
    ?>

    Now if you link to your rss2 file like so:

    /wp-rss2.php?pages

    It will list Pages, and only Pages, in the feed. For a custom link (/feed/pages/), insert this into your .htaccess:

    RewriteRule ^feed/pages/?$ /index.php?feed=rss2&pages [QSA,L]

    For multiple syndication formats:

    RewriteRule ^feed/(rdf|rss|rss2|atom)/pages/?$ /index.php?feed=$1&pages [QSA,L]

    Note that I agree with Ryan that it seems you’d be better off managing this through a category, but if you must…

    Slight modification to my code, to make sure to display the most recent Pages (i.e. chronologically):

    <?php
    if(isset($_GET['pages']))
    $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static' ORDER BY post_date DESC");
    ?>

    man thanks so much kafkaesqui and ryan, in my situation in the 1.3 alphas I was showing particular categories on different indexes to control sections of my site, the big problem came in with commenting on those entries, upon making the comment and hitting send it you would be redirected to the main index and the entry with the comment displayed there rather than on the page that the comment was made on…

    * which is bad because the main index has a 3 col layout and the index’s i’m displaying specific categories have 2 col layouts.

    Wow, thanks for this! This is great. I’ve been in the same situation as lokjah, so I haven’t been able to get categories to work. But I think this will work for now.

    I have one question about a possible tweak in the code. Is there any way to change the title of the feed (as it is displayed in your rss reader) if pages are requested instead of posts?

    for example: if the regular feed is requested, the title shows up as “My Blog,” while if the pages feed is requested, the title shows up as “My Pages”?

    huh – one more update: It doesn’t seem to be picking up the formatting of the post — line breaks, links, anything. It’s all displayed as one line, no formatting, no links (in my rss reader).

    They always want more…

    If you’re set under Options > Reading, “Syndication Feeds” to only show summaries, the exerpt that is displayed strips any html (hence no <p>, <br />, <img> etc). Setting this to Full text lets through everything in the feed. Most current feed readers handle html, but there’s always the chance a rare reader will balk. So warned.

    For the title issue, you can swap the <title> element in the rss template depending on if the ‘pages’ query is being passed:

    <?php if(isset($_GET['pages'])) : ?>
    <title>MY TITLE FOR PAGES</title>
    <?php else : ?>
    <title><?php bloginfo_rss('name'); ?></title>
    <?php endif : ?>

    Damn, I’m acting like a client, huh 😉

    OK, changing to full posts instead of summaries (which is actually what I wanted anyways) fixed that. Thanks!

    I went to drop that title switcher in and realized that I don’t know where to put your code. Tried a couple different places, and wherever I put it, suddenly my RSS didn’t work at all anymore – posts or pages. So where does that code go?

    Thanks for all the help!

    Hey, thanks again for all the help, Kafka. I got it working!

    Just so you know, there was a typo in your code. The very last endif needs to be <?php endif; ?>

    Thanks again! I really appreciate the help!

    Look for the <title> tag in the file. There are only two places it occurs: after <channel>, and after <item>. You want to replace the one after the first (<channel>), which by default is:

    <title><?php bloginfo_rss('name'); ?></title>

    “The very last endif needs to be <?php endif; ?>”

    Oops. Thanks for noting it here (in case someone else needs it).

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘RSS feed of 1.5 pages?’ is closed to new replies.