WordPress.org

Ready to get started?Download WordPress

Forums

RSS feed of 1.5 pages? (23 posts)

  1. davidcorrell
    Member
    Posted 9 years ago #

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

  2. Kafkaesqui

    Posted 9 years ago #

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

  3. davidcorrell
    Member
    Posted 9 years ago #

    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.

  4. Kafkaesqui

    Posted 9 years ago #

    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.

  5. lokjah
    Member
    Posted 9 years ago #

    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

  6. lokjah
    Member
    Posted 9 years ago #

    throwing a hail mary bump~

  7. Ryan Boren
    WordPress Dev
    Posted 9 years ago #

    Pages aren't posts. Consider using a category.

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

  8. Kafkaesqui

    Posted 9 years ago #

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

  9. Kafkaesqui

    Posted 9 years ago #

    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");
    ?>

  10. lokjah
    Member
    Posted 9 years ago #

    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.

  11. davidcorrell
    Member
    Posted 9 years ago #

    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"?

  12. davidcorrell
    Member
    Posted 9 years ago #

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

  13. Kafkaesqui

    Posted 9 years ago #

    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 : ?>

  14. davidcorrell
    Member
    Posted 9 years ago #

    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!

  15. davidcorrell
    Member
    Posted 9 years ago #

    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!

  16. Kafkaesqui

    Posted 9 years ago #

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

  17. davidcorrell
    Member
    Posted 9 years ago #

    Hey Kafkaesqui, you out there? Man, I need your help. After working with this for a little bit, I've realized that it's really not working. It's doing some very weird things.

    First thing I noticed is that when I post a page, NetNewsWire isn't getting the update. The weird thing, is that it's working in MacNews, just not NewNewsWire. I haven't tested it on a PC, so I don't know if it's working there, but either way, it only partially working.

    The other thing I've run into is that when I post a regular post, this it will update an old page. I haven't figured out yet if it's just a random page or if there's a system to it, but it's doing something screwey.

    Any help would be greatly appreciated. Thanks!

  18. etfreedman
    Member
    Posted 9 years ago #


  19. kmtcn
    Member
    Posted 9 years ago #

    Is there an update to this snippet that's needed to keep rss for pages going when moving to WP 1.5.1?

    I just got pages rss going a few days ago, and now they've died with the installation of WP 1.5.1 - urrrgggghhh :)

  20. iand
    Member
    Posted 9 years ago #

    Try editing/writing a new page? Doing the same for posts and comments seems to work for those feeds.

  21. vegasman
    Member
    Posted 8 years ago #

    I would like to post rss feeds on pages I create. With the include php. I have found plugin that enables me to do this. But it displays the rss feed below the sidebar in the body instead of next to it. How can I fix this to dispay correctly. Example: http://www.newlifepub.com/blog/?page_id=3

  22. war59312
    Member
    Posted 8 years ago #

    Can you post link to plugin please?

    And to get rss to sidebar you need to place the code right under:

    <div id="sidebar">

    so just search for that and cut and paste the rss code after it. Should work.

    If not simply move all the rss code to sidbar.php in theme folder. I use connections theme as well. :)

    So would love to have the plugin your talking about. ;)

  23. lynxpardina
    Member
    Posted 8 years ago #

    Hi, I'm interesting in adding RSS capability for pages, I've tried the code provided by Kafkasky, and its works, but I have a problem. When I see the feeds (I use Mozilla Thunderbird) in the place of the title appears the content of the page.
    I tried to include directly the following code:

    <?php if(isset($_GET['pages'])) : ?>
    <title><?php $post->post_title; ?></title>
    <?php else : ?>
    <title><?php the_title_rss ?></title>
    <?php endif; ?>

    but in the reader appears the content in the title, anyway.
    Any idea of why this happens.
    ¿Is there any plugin for RSS feeds on pages working for WordPress 1.5.2?
    My page is http://gsm.org.es/gsm
    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.